1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-22 13:41:26 +00:00
nixpkgs/nixos/tests/specialisation.nix
Graham Christensen ec2d28e323
specialisation: replace nesting with named configurations
Co-authored-by: worldofpeace <worldofpeace@protonmail.ch>
2020-04-12 08:12:50 -04:00

44 lines
1.4 KiB
Nix

import ./make-test-python.nix {
name = "specialisation";
nodes = {
inheritconf = { pkgs, ... }: {
environment.systemPackages = [ pkgs.cowsay ];
specialisation.inheritconf.configuration = { pkgs, ... }: {
environment.systemPackages = [ pkgs.hello ];
};
};
noinheritconf = { pkgs, ... }: {
environment.systemPackages = [ pkgs.cowsay ];
specialisation.noinheritconf = {
inheritParentConfig = false;
configuration = { pkgs, ... }: {
environment.systemPackages = [ pkgs.hello ];
};
};
};
};
testScript = ''
inheritconf.wait_for_unit("default.target")
inheritconf.succeed("cowsay hey")
inheritconf.fail("hello")
with subtest("Nested clones do inherit from parent"):
inheritconf.succeed(
"/run/current-system/specialisation/inheritconf/bin/switch-to-configuration test"
)
inheritconf.succeed("cowsay hey")
inheritconf.succeed("hello")
noinheritconf.wait_for_unit("default.target")
noinheritconf.succeed("cowsay hey")
noinheritconf.fail("hello")
with subtest("Nested children do not inherit from parent"):
noinheritconf.succeed(
"/run/current-system/specialisation/noinheritconf/bin/switch-to-configuration test"
)
noinheritconf.fail("cowsay hey")
noinheritconf.succeed("hello")
'';
}