Set up Cargo and Nix project
This commit is contained in:
+54
@@ -0,0 +1,54 @@
|
||||
{
|
||||
lib,
|
||||
rustPlatform,
|
||||
}:
|
||||
|
||||
let
|
||||
srcRoot = ./.;
|
||||
srcRootString = toString srcRoot;
|
||||
sourceFilter =
|
||||
path: type:
|
||||
let
|
||||
pathString = toString path;
|
||||
relPath = lib.removePrefix "${srcRootString}/" pathString;
|
||||
baseName = baseNameOf pathString;
|
||||
isExcludedTree = dir: relPath == dir || lib.hasPrefix "${dir}/" relPath;
|
||||
in
|
||||
!(
|
||||
baseName == ".git"
|
||||
|| baseName == "target"
|
||||
|| baseName == "result"
|
||||
|| isExcludedTree ".yoi"
|
||||
|| isExcludedTree ".worktree"
|
||||
);
|
||||
in
|
||||
rustPlatform.buildRustPackage {
|
||||
pname = "decodal";
|
||||
version = "0.1.0";
|
||||
|
||||
src = lib.cleanSourceWith {
|
||||
src = srcRoot;
|
||||
filter = sourceFilter;
|
||||
};
|
||||
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
doInstallCheck = true;
|
||||
installCheckPhase = ''
|
||||
runHook preInstallCheck
|
||||
|
||||
test -x "$out/bin/decodal"
|
||||
"$out/bin/decodal" >/dev/null
|
||||
|
||||
runHook postInstallCheck
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Deferred Constraint Data Language";
|
||||
license = lib.licenses.mit;
|
||||
mainProgram = "decodal";
|
||||
platforms = lib.platforms.unix;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user