summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorJaka Hudoklin <jakahudoklin@gmail.com>2014-12-12 02:54:53 +0100
committerJaka Hudoklin <jakahudoklin@gmail.com>2014-12-12 02:55:23 +0100
commitf2e20fa83729981c679b4dfb1689db8ca3f70ec7 (patch)
tree464c62bdd21dda51f026d006d05af305e0c12163 /nixos
parent1f9acba0880a5b87ba5360f9a85b3f3778c1af1b (diff)
downloadnixlib-f2e20fa83729981c679b4dfb1689db8ca3f70ec7.tar
nixlib-f2e20fa83729981c679b4dfb1689db8ca3f70ec7.tar.gz
nixlib-f2e20fa83729981c679b4dfb1689db8ca3f70ec7.tar.bz2
nixlib-f2e20fa83729981c679b4dfb1689db8ca3f70ec7.tar.lz
nixlib-f2e20fa83729981c679b4dfb1689db8ca3f70ec7.tar.xz
nixlib-f2e20fa83729981c679b4dfb1689db8ca3f70ec7.tar.zst
nixlib-f2e20fa83729981c679b4dfb1689db8ca3f70ec7.zip
nixos: container profile, update /init symlink on rebuild
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/profiles/container.nix15
1 files changed, 8 insertions, 7 deletions
diff --git a/nixos/modules/profiles/container.nix b/nixos/modules/profiles/container.nix
index 5b531e5c3dfa..e6344a0d5c7a 100644
--- a/nixos/modules/profiles/container.nix
+++ b/nixos/modules/profiles/container.nix
@@ -20,17 +20,18 @@ in {
     contents = [];
     extraArgs = "--owner=0";
 
-    # Some container managers like lxc need these
-    extraCommands = "mkdir -p proc sys dev";
-
     # Add init script to image
     storeContents = [
       { object = config.system.build.toplevel + "/init";
         symlink = "/init";
       }
     ] ++ (pkgs2storeContents [ pkgs.stdenv ]);
+
+    # Some container managers like lxc need these
+    extraCommands = "mkdir -p proc sys dev";
   };
 
+  boot.isContainer = true;
   boot.postBootCommands =
     ''
       # After booting, register the contents of the Nix store in the Nix
@@ -46,12 +47,12 @@ in {
       ${config.nix.package}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
     '';
 
-  boot.isContainer = true;
-
   # Disable some features that are not useful in a container.
   sound.enable = mkDefault false;
   services.udisks2.enable = mkDefault false;
 
-  # Shut up warnings about not having a boot loader.
-  system.build.installBootLoader = "${pkgs.coreutils}/bin/true";
+  # Install new init script
+  system.activationScripts.installInitScript = ''
+    ln -fs $systemConfig/init /init
+  '';
 }