summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaciej Krüger <mkg20001@gmail.com>2021-05-01 00:23:45 +0200
committerMaciej Krüger <mkg20001@gmail.com>2021-11-03 07:49:53 +0100
commitfec499bb98f4f989c0bff7d6304fba1c9b79ab99 (patch)
tree0fabc24152bd48be2eae3c08f27d6d15a2a776ed
parent8eac2a669a4c2ac78e4f1a571c9aead2767db507 (diff)
downloadnixpkgs-fec499bb98f4f989c0bff7d6304fba1c9b79ab99.tar
nixpkgs-fec499bb98f4f989c0bff7d6304fba1c9b79ab99.tar.gz
nixpkgs-fec499bb98f4f989c0bff7d6304fba1c9b79ab99.tar.bz2
nixpkgs-fec499bb98f4f989c0bff7d6304fba1c9b79ab99.tar.lz
nixpkgs-fec499bb98f4f989c0bff7d6304fba1c9b79ab99.tar.xz
nixpkgs-fec499bb98f4f989c0bff7d6304fba1c9b79ab99.tar.zst
nixpkgs-fec499bb98f4f989c0bff7d6304fba1c9b79ab99.zip
virtualisation.lxc: replace /sbin/init on switch
in the future maybe a proper shim-bootloader could be used that supports 
switching out /sbin/init (so nixos-rebuild boot would just switch the 
link)
-rw-r--r--nixos/modules/virtualisation/lxc-container.nix4
1 files changed, 4 insertions, 0 deletions
diff --git a/nixos/modules/virtualisation/lxc-container.nix b/nixos/modules/virtualisation/lxc-container.nix
index 32222e2793b..8e7eeb3525f 100644
--- a/nixos/modules/virtualisation/lxc-container.nix
+++ b/nixos/modules/virtualisation/lxc-container.nix
@@ -143,6 +143,10 @@ in
     # Allow the user to login as root without password.
     users.users.root.initialHashedPassword = mkOverride 150 "";
 
+    system.activationScripts.installInitScript = mkForce ''
+      ln -fs $systemConfig/init /sbin/init
+    '';
+
     # Some more help text.
     services.getty.helpLine =
       ''