cluster/catalog: expose simulacrum tests
This commit is contained in:
parent
96b36b68db
commit
6fb12b3dff
2 changed files with 36 additions and 0 deletions
|
@ -2,5 +2,6 @@
|
|||
imports = [
|
||||
./services.nix
|
||||
./secrets.nix
|
||||
./simulacrum.nix
|
||||
];
|
||||
}
|
||||
|
|
35
cluster/catalog/simulacrum.nix
Normal file
35
cluster/catalog/simulacrum.nix
Normal 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);
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Reference in a new issue