about summary refs log tree commit diff
path: root/nixos/tests/nesting.nix
diff options
context:
space:
mode:
authorArian van Putten <aeroboy94@gmail.com>2019-05-26 00:35:29 +0200
committerArian van Putten <aeroboy94@gmail.com>2019-05-26 00:37:13 +0200
commita48047a755047b34471a740dffa07744221d63c2 (patch)
tree012d2152ca867b2405e617f0143172e653e8aefa /nixos/tests/nesting.nix
parentd50b43423455ac06f3e237dbc0a0c98bcb4b5dcf (diff)
downloadnixlib-a48047a755047b34471a740dffa07744221d63c2.tar
nixlib-a48047a755047b34471a740dffa07744221d63c2.tar.gz
nixlib-a48047a755047b34471a740dffa07744221d63c2.tar.bz2
nixlib-a48047a755047b34471a740dffa07744221d63c2.tar.lz
nixlib-a48047a755047b34471a740dffa07744221d63c2.tar.xz
nixlib-a48047a755047b34471a740dffa07744221d63c2.tar.zst
nixlib-a48047a755047b34471a740dffa07744221d63c2.zip
nixos: Add test that demonstrates how to use nesting.clone
This is actually very useful. Allows you to test switch-to-configuration

nesting.children is still currently still broken as it will throw
away 'too much' of the config, including the modules that make
nixos tests work in the first place. But that's something for
another time.
Diffstat (limited to 'nixos/tests/nesting.nix')
-rw-r--r--nixos/tests/nesting.nix22
1 files changed, 22 insertions, 0 deletions
diff --git a/nixos/tests/nesting.nix b/nixos/tests/nesting.nix
new file mode 100644
index 000000000000..3be64d7a9b54
--- /dev/null
+++ b/nixos/tests/nesting.nix
@@ -0,0 +1,22 @@
+import ./make-test.nix {
+  name = "nesting";
+  machine = { pkgs, ... }: {
+    environment.systemPackages = [ pkgs.cowsay ];
+    nesting.clone = [
+      ({ pkgs, ... }: {
+        environment.systemPackages = [ pkgs.hello ];
+      })
+    ];
+  };
+  testScript = ''
+    $machine->waitForUnit("default.target");
+    $machine->succeed("cowsay hey");
+    $machine->fail("hello");
+
+    # Nested clones do inherit from parent
+    $machine->succeed("/run/current-system/fine-tune/child-1/bin/switch-to-configuration test");
+    $machine->succeed("cowsay hey");
+    $machine->succeed("hello");
+
+  '';
+}