about summary refs log tree commit diff
path: root/nixpkgs/nixos/tests/nesting.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/nixos/tests/nesting.nix')
-rw-r--r--nixpkgs/nixos/tests/nesting.nix42
1 files changed, 42 insertions, 0 deletions
diff --git a/nixpkgs/nixos/tests/nesting.nix b/nixpkgs/nixos/tests/nesting.nix
new file mode 100644
index 000000000000..1306d6f8e0c5
--- /dev/null
+++ b/nixpkgs/nixos/tests/nesting.nix
@@ -0,0 +1,42 @@
+import ./make-test.nix {
+  name = "nesting";
+  nodes =  {
+    clone = { pkgs, ... }: {
+      environment.systemPackages = [ pkgs.cowsay ];
+      nesting.clone = [
+        ({ pkgs, ... }: {
+          environment.systemPackages = [ pkgs.hello ];
+        })
+      ];
+    };
+    children = { pkgs, ... }: {
+      environment.systemPackages = [ pkgs.cowsay ];
+      nesting.children = [
+        ({ pkgs, ... }: {
+          environment.systemPackages = [ pkgs.hello ];
+        })
+      ];
+    };
+  };
+  testScript = ''
+    $clone->waitForUnit("default.target");
+    $clone->succeed("cowsay hey");
+    $clone->fail("hello");
+
+    # Nested clones do inherit from parent
+    $clone->succeed("/run/current-system/fine-tune/child-1/bin/switch-to-configuration test");
+    $clone->succeed("cowsay hey");
+    $clone->succeed("hello");
+    
+
+    $children->waitForUnit("default.target");
+    $children->succeed("cowsay hey");
+    $children->fail("hello");
+
+    # Nested children do not inherit from parent
+    $children->succeed("/run/current-system/fine-tune/child-1/bin/switch-to-configuration test");
+    $children->fail("cowsay hey");
+    $children->succeed("hello");
+
+  '';
+}