Files
nixpkgs/nixos/tests/ifstate/initrd.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

66 lines
1.4 KiB
Nix

let
mkIfStateConfig = id: {
enable = true;
settings.interfaces.eth1 = {
addresses = [ "2001:0db8::${builtins.toString id}/64" ];
link = {
state = "up";
kind = "physical";
};
};
};
in
{
name = "ifstate-initrd";
nodes = {
server = {
imports = [ ../../modules/profiles/minimal.nix ];
virtualisation.interfaces.eth1.vlan = 1;
# Initrd IfState enforces stage 2 ifstate using assertion.
networking.ifstate = {
enable = true;
settings.interfaces = { };
};
boot.initrd = {
network = {
enable = true;
ifstate = mkIfStateConfig 1 // {
allowIfstateToDrasticlyIncreaseInitrdSize = true;
};
};
systemd = {
enable = true;
network.enable = false;
services.boot-blocker = {
before = [ "initrd.target" ];
wantedBy = [ "initrd.target" ];
script = "sleep infinity";
serviceConfig.Type = "oneshot";
};
};
};
};
client = {
imports = [ ../../modules/profiles/minimal.nix ];
virtualisation.interfaces.eth1.vlan = 1;
networking.ifstate = mkIfStateConfig 2;
};
};
testScript = # python
''
start_all()
client.wait_for_unit("network.target")
# try to ping the server from the client
client.wait_until_succeeds("ping -c 1 2001:0db8::1")
'';
}