[nix] Allow skipping checks
This commit is contained in:
parent
b58db2d3c0
commit
cbf8bfce32
|
@ -2,13 +2,22 @@
|
|||
day1 = {
|
||||
part1 = "53194";
|
||||
part2 = "54249";
|
||||
checkHaskell = true;
|
||||
checkBash = true;
|
||||
checkRust = true;
|
||||
};
|
||||
day2 = {
|
||||
part1 = "2406";
|
||||
part2 = "78375";
|
||||
checkHaskell = true;
|
||||
checkBash = true;
|
||||
checkRust = true;
|
||||
};
|
||||
day3 = {
|
||||
part1 = "531932";
|
||||
part2 = "73646890";
|
||||
checkHaskell = true;
|
||||
checkBash = false;
|
||||
checkRust = false;
|
||||
};
|
||||
}
|
||||
|
|
21
flake.nix
21
flake.nix
|
@ -64,23 +64,30 @@
|
|||
};
|
||||
};
|
||||
checks =
|
||||
let mkCheck = (lang: exec: day: parts: {
|
||||
let mkCheck = (lang: exec: day: assertions:
|
||||
if assertions."check${lang}" then {
|
||||
name = "${lang}-${day}";
|
||||
value = pkgs.testers.testEqualContents {
|
||||
assertion = "${lang}: ${day}";
|
||||
expected = pkgs.writeText "expected" ''
|
||||
Part 1 Answer: ${parts.part1}
|
||||
Part 2 Answer: ${parts.part2}
|
||||
Part 1 Answer: ${assertions.part1}
|
||||
Part 2 Answer: ${assertions.part2}
|
||||
'';
|
||||
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
|
||||
// pkgs.lib.attrsets.mapAttrs' (mkCheck "bash" "${packages.aoc2023-bash}/bin/aoc2023") answers
|
||||
// pkgs.lib.attrsets.mapAttrs' (mkCheck "rust" "${packages.aoc2023-rust}/bin/aoc2023") answers;
|
||||
in
|
||||
pkgs.lib.attrsets.mapAttrs' (mkCheck "Haskell" "${packages.aoc2023-haskell}/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;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue