Decodal/package.nix

55 lines
1.1 KiB
Nix

{
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;
};
}