cluster/catalog: expose simulacrum tests

This commit is contained in:
Max Headroom 2024-07-23 02:45:40 +02:00
parent 96b36b68db
commit 6fb12b3dff
2 changed files with 36 additions and 0 deletions

View file

@ -2,5 +2,6 @@
imports = [
./services.nix
./secrets.nix
./simulacrum.nix
];
}

View file

@ -0,0 +1,35 @@
{ config, extendModules, lib, ... }:
let
inherit (config) cluster;
in
{
perSystem = { pkgs, ... }: {
catalog.cluster = {
simulacrum = lib.mapAttrs (name: svc: {
description = "Simulacrum test: ${name}";
actions = let
runSimulacrum = pkgs.callPackage ../simulacrum {
inherit config extendModules;
};
test = runSimulacrum {
service = name;
};
in {
build = {
description = "Build this test.";
command = "nix build -L --no-link '${builtins.unsafeDiscardStringContext test.drvPath}^*'";
};
runInteractive = {
description = "Run interactive driver.";
command = ''
${pkgs.bubblewrap}/bin/bwrap --unshare-all --bind / / --dev-bind /dev /dev ${lib.getExe test.driverInteractive}
'';
};
};
}) (lib.filterAttrs (_: svc: svc.simulacrum.enable) cluster.config.services);
};
};
}