dotfiles/nixos/tests/hel/default.nix
magic_rb 0e7389fcbd
More network test work
Signed-off-by: magic_rb <magic_rb@redalder.org>
2024-08-14 15:59:24 +02:00

113 lines
2.2 KiB
Nix

{
inputs,
lib,
self,
...
}: let
inherit
(lib)
singleton
concatMap
mkDefault
mkImageMediaOverride
;
in {
flake.nixosConfigurations.hela = inputs.nixpkgs-stable.lib.nixosSystem {
system = "x86_64-linux";
modules =
singleton
(import ./hela.nix);
specialArgs = {
inputs' = inputs;
};
};
flake.nixosConfigurations."jörmungandr" = inputs.nixpkgs-stable.lib.nixosSystem {
system = "x86_64-linux";
modules =
singleton
(import ./jormungandr.nix);
specialArgs = {
inputs' = inputs;
};
};
flake.nixosConfigurations.client = inputs.nixpkgs-stable.lib.nixosSystem {
system = "x86_64-linux";
modules =
singleton
(import ./client.nix);
specialArgs = {
inputs' = inputs;
};
};
perSystem = {
lib,
pkgs,
system,
...
}: {
checks.router = pkgs.stdenv.mkDerivation {
name = "router";
phases = [
"runPhase"
];
env = {
HELA_SYSTEM =
(self.nixosConfigurations.hela.extendModules {
modules = [
"${pkgs.path}/nixos/modules/testing/test-instrumentation.nix"
];
})
.config
.system
.build
.vm;
CLIENT_SYSTEM =
(self.nixosConfigurations.client.extendModules {
modules = [
"${pkgs.path}/nixos/modules/testing/test-instrumentation.nix"
];
})
.config
.system
.build
.vm;
JORMUNGANDR_SYSTEM =
(self.nixosConfigurations."jörmungandr".extendModules {
modules = [
"${pkgs.path}/nixos/modules/testing/test-instrumentation.nix"
];
})
.config
.system
.build
.vm;
};
nativeBuildInputs = with pkgs; [
iproute2
vde2
socat
(python3.withPackages (ps:
with ps; [
ptpython
colorama
junit-xml
]))
];
runPhase = ''
PYTHONPATH=${pkgs.path}/nixos/lib/test-driver python ${../router.py}
mkdir -p $out
touch $out/success
'';
};
};
}