[nix] Allow skipping checks
This commit is contained in:
parent
b58db2d3c0
commit
cbf8bfce32
|
@ -2,13 +2,22 @@
|
||||||
day1 = {
|
day1 = {
|
||||||
part1 = "53194";
|
part1 = "53194";
|
||||||
part2 = "54249";
|
part2 = "54249";
|
||||||
|
checkHaskell = true;
|
||||||
|
checkBash = true;
|
||||||
|
checkRust = true;
|
||||||
};
|
};
|
||||||
day2 = {
|
day2 = {
|
||||||
part1 = "2406";
|
part1 = "2406";
|
||||||
part2 = "78375";
|
part2 = "78375";
|
||||||
|
checkHaskell = true;
|
||||||
|
checkBash = true;
|
||||||
|
checkRust = true;
|
||||||
};
|
};
|
||||||
day3 = {
|
day3 = {
|
||||||
part1 = "531932";
|
part1 = "531932";
|
||||||
part2 = "73646890";
|
part2 = "73646890";
|
||||||
|
checkHaskell = true;
|
||||||
|
checkBash = false;
|
||||||
|
checkRust = false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
45
flake.nix
45
flake.nix
|
@ -56,31 +56,38 @@
|
||||||
filter = path: type:
|
filter = path: type:
|
||||||
let baseName = baseNameOf (toString path);
|
let baseName = baseNameOf (toString path);
|
||||||
in pkgs.lib.cleanSourceFilter path type &&
|
in pkgs.lib.cleanSourceFilter path type &&
|
||||||
(pkgs.lib.strings.hasInfix "rust" path ||
|
(pkgs.lib.strings.hasInfix "rust" path ||
|
||||||
baseName == "Cargo.toml" ||
|
baseName == "Cargo.toml" ||
|
||||||
baseName == "Cargo.lock");
|
baseName == "Cargo.lock");
|
||||||
};
|
};
|
||||||
cargoSha256 = "sha256-e27WE9K2yby+6vzu0cDojtG0+aTdED7vt7wFgEd2dAw=";
|
cargoSha256 = "sha256-e27WE9K2yby+6vzu0cDojtG0+aTdED7vt7wFgEd2dAw=";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
checks =
|
checks =
|
||||||
let mkCheck = (lang: exec: day: parts: {
|
let mkCheck = (lang: exec: day: assertions:
|
||||||
name = "${lang}-${day}";
|
if assertions."check${lang}" then {
|
||||||
value = pkgs.testers.testEqualContents {
|
name = "${lang}-${day}";
|
||||||
assertion = "${lang}: ${day}";
|
value = pkgs.testers.testEqualContents {
|
||||||
expected = pkgs.writeText "expected" ''
|
assertion = "${lang}: ${day}";
|
||||||
Part 1 Answer: ${parts.part1}
|
expected = pkgs.writeText "expected" ''
|
||||||
Part 2 Answer: ${parts.part2}
|
Part 1 Answer: ${assertions.part1}
|
||||||
'';
|
Part 2 Answer: ${assertions.part2}
|
||||||
actual = pkgs.runCommandLocal "actual" {} ''
|
'';
|
||||||
"${exec}" "${day}" < "${./input}/${day}" >$out
|
actual = pkgs.runCommandLocal "actual" {} ''
|
||||||
'';
|
"${exec}" "${day}" < "${./input}/${day}" >$out
|
||||||
};
|
'';
|
||||||
});
|
};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
name = "${lang}-${day}-skipped";
|
||||||
|
value = pkgs.hello;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
in pkgs.lib.attrsets.mapAttrs' (mkCheck "haskell" "${packages.aoc2023-haskell}/bin/aoc2023") answers
|
in
|
||||||
// pkgs.lib.attrsets.mapAttrs' (mkCheck "bash" "${packages.aoc2023-bash}/bin/aoc2023") answers
|
pkgs.lib.attrsets.mapAttrs' (mkCheck "Haskell" "${packages.aoc2023-haskell}/bin/aoc2023") answers
|
||||||
// pkgs.lib.attrsets.mapAttrs' (mkCheck "rust" "${packages.aoc2023-rust}/bin/aoc2023") answers;
|
// pkgs.lib.attrsets.mapAttrs' (mkCheck "Bash" "${packages.aoc2023-bash}/bin/aoc2023") answers
|
||||||
|
// pkgs.lib.attrsets.mapAttrs' (mkCheck "Rust" "${packages.aoc2023-rust}/bin/aoc2023") answers;
|
||||||
defaultPackage = packages.dev-env;
|
defaultPackage = packages.dev-env;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue