about summary refs log tree commit diff
path: root/nixos/tests/systemd-machinectl.nix
diff options
context:
space:
mode:
authorChristian Kögler <ck3d@gmx.de>2024-03-14 22:07:27 +0100
committerChristian Kögler <ck3d@gmx.de>2024-03-14 22:07:58 +0100
commitf4f99bf8cc1b1ede7b3cd7274348d302701166f9 (patch)
treeecfed9b3f6aa75fbbd5f70e3114a930cfdda9f72 /nixos/tests/systemd-machinectl.nix
parentbdd7e48646795b3239e2c53e475612402d7d3c01 (diff)
nixos/tests/machinectl: Add declarative shared container
Diffstat (limited to 'nixos/tests/systemd-machinectl.nix')
-rw-r--r--nixos/tests/systemd-machinectl.nix19
1 files changed, 17 insertions, 2 deletions
diff --git a/nixos/tests/systemd-machinectl.nix b/nixos/tests/systemd-machinectl.nix
index b6698e45bd96c..02b4d9c590b59 100644
--- a/nixos/tests/systemd-machinectl.nix
+++ b/nixos/tests/systemd-machinectl.nix
@@ -42,8 +42,18 @@ import ./make-test-python.nix ({ pkgs, ... }:
 
       virtualisation.additionalPaths = [ containerSystem ];
 
-      # not needed, but we want to test the nspawn file generation
-      systemd.nspawn.${containerName} = { };
+      systemd.tmpfiles.rules = [
+        "d /var/lib/machines/shared-decl 0755 root root - -"
+      ];
+      systemd.nspawn.shared-decl = {
+        execConfig = {
+          Boot = false;
+          Parameters = "${containerSystem}/init";
+        };
+        filesConfig = {
+          BindReadOnly = "/nix/store";
+        };
+      };
 
       systemd.services."systemd-nspawn@${containerName}" = {
         serviceConfig.Environment = [
@@ -63,6 +73,11 @@ import ./make-test-python.nix ({ pkgs, ... }:
       start_all()
       machine.wait_for_unit("default.target");
 
+      # Test machinectl start stop of shared-decl
+      machine.succeed("machinectl start shared-decl");
+      machine.wait_until_succeeds("systemctl -M shared-decl is-active default.target");
+      machine.succeed("machinectl stop shared-decl");
+
       # create containers root
       machine.succeed("mkdir -p ${containerRoot}");