packages/catalog: expose simulacrum checks differently

This commit is contained in:
Max Headroom 2024-07-23 20:07:16 +02:00
parent 692014a7a2
commit d502f3b7a8

View file

@ -1,10 +1,19 @@
{ lib, ... }: { lib, ... }:
{ {
perSystem = { config, ... }: { perSystem = { config, pkgs, ... }: {
catalog.depot = { catalog = lib.mkMerge (lib.mapAttrsToList (name': check: let
checks = lib.mapAttrs (name: check: { simulacrum = lib.hasPrefix "simulacrum-" name';
description = "NixOS Test: ${name}"; name = lib.removePrefix "simulacrum-" name';
baseAttrPath = if simulacrum then
[ "cluster" "simulacrum" ]
else
[ "depot" "checks" ];
in lib.setAttrByPath (baseAttrPath ++ [ name ]) {
description = if simulacrum then
"Simulacrum Test: ${name}"
else
"NixOS Test: ${name}";
actions = { actions = {
build = { build = {
description = "Build this check."; description = "Build this check.";
@ -12,10 +21,12 @@
}; };
runInteractive = { runInteractive = {
description = "Run interactive driver."; description = "Run interactive driver.";
command = lib.getExe check.driverInteractive; command = if simulacrum then
"${pkgs.bubblewrap}/bin/bwrap --unshare-all --bind / / --dev-bind /dev /dev ${lib.getExe check.driverInteractive}"
else
lib.getExe check.driverInteractive;
}; };
}; };
}) config.checks; }) config.checks);
};
}; };
} }