2024-07-06 00:59:18 +03:00
|
|
|
{ lib, ... }:
|
|
|
|
|
|
|
|
{
|
2024-07-23 21:07:16 +03:00
|
|
|
perSystem = { config, pkgs, ... }: {
|
|
|
|
catalog = lib.mkMerge (lib.mapAttrsToList (name': check: let
|
|
|
|
simulacrum = lib.hasPrefix "simulacrum-" 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 = {
|
|
|
|
build = {
|
|
|
|
description = "Build this check.";
|
|
|
|
command = "nix build -L --no-link '${builtins.unsafeDiscardStringContext check.drvPath}^*'";
|
2024-07-06 00:59:18 +03:00
|
|
|
};
|
2024-07-23 21:07:16 +03:00
|
|
|
runInteractive = {
|
|
|
|
description = "Run interactive driver.";
|
|
|
|
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);
|
2024-07-06 00:59:18 +03:00
|
|
|
};
|
|
|
|
}
|