Set up nix flake
This commit is contained in:
parent
92232bea96
commit
b2b35d1b8f
|
@ -1 +1,2 @@
|
|||
/target
|
||||
/result
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1649676176,
|
||||
"narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1649619156,
|
||||
"narHash": "sha256-p0q4zpuKMwrzGF+5ZU7Thnpac5TinhDI9jr2mBxhV4w=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e7d63bd0d50df412f5a1d8acfa3caae75522e347",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-21.11",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
{
|
||||
description = "Collection of DSLs which can solve discrete mathematics problems";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/nixos-21.11";
|
||||
|
||||
flake-utils = {
|
||||
url = "github:numtide/flake-utils";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
outputs = { self, flake-utils, nixpkgs }:
|
||||
flake-utils.lib.eachSystem [
|
||||
"aarch64-linux"
|
||||
"aarch64-darwin"
|
||||
"i686-linux"
|
||||
"x86_64-darwin"
|
||||
"x86_64-linux"
|
||||
]
|
||||
(system: let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
cargoTOML = pkgs.lib.importTOML ./Cargo.toml;
|
||||
version = cargoToml.package.version;
|
||||
in rec {
|
||||
|
||||
defaultApp = apps.diskmat-tools;
|
||||
|
||||
apps.diskmat-tools = {
|
||||
type = "app";
|
||||
program = "${packages.diskmat-tools}/bin/diskmat_tools";
|
||||
};
|
||||
|
||||
defaultPackage = packages.diskmat-tools;
|
||||
|
||||
packages = {
|
||||
|
||||
diskmat-tools = pkgs.rustPlatform.buildRustPackage {
|
||||
pname = "diskmat-tools";
|
||||
inherit version;
|
||||
src = ./.;
|
||||
|
||||
buildInputs = [ pkgs.graphviz ];
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
};
|
||||
|
||||
diskmat-tools-examples = pkgs.stdenv.mkDerivation {
|
||||
pname = "diskmat-tools-examples";
|
||||
inherit version;
|
||||
src = ./example_files;
|
||||
nativeBuildInputs = [ packages.diskmat-tools ];
|
||||
|
||||
# TODO: `rm -r matrix` should be removed after support is implemented
|
||||
buildPhase = ''
|
||||
rm -r matrix
|
||||
for file in $(find -type f)
|
||||
do
|
||||
diskmat_tools -i $file -o "''${file%.*}.png"
|
||||
done
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir $out
|
||||
cp -r . $out
|
||||
'';
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
});
|
||||
}
|
|
@ -78,9 +78,9 @@ fn main() -> std::io::Result<()> {
|
|||
match args.t.as_deref() {
|
||||
Some("ba") => BAParser::parse(&mut input),
|
||||
Some("tt") => TTParser::parse(&mut input),
|
||||
Some("mx") => panic!("Not implemented yet"),
|
||||
_ => panic!("Doesn't recognize file"),
|
||||
}
|
||||
// parse(&mut input)
|
||||
} else if args.input.is_some() {
|
||||
// } else {
|
||||
let t = args.input.unwrap();
|
||||
|
@ -89,6 +89,7 @@ fn main() -> std::io::Result<()> {
|
|||
match t.split('.').last() {
|
||||
Some("ba") => BAParser::parse(&mut input),
|
||||
Some("tt") => TTParser::parse(&mut input),
|
||||
Some("mx") => panic!("Not implemented yet"),
|
||||
_ => panic!("Doesn't recognize file"),
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue