From f2e20fa83729981c679b4dfb1689db8ca3f70ec7 Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Fri, 12 Dec 2014 02:54:53 +0100 Subject: nixos: container profile, update /init symlink on rebuild --- nixos/modules/profiles/container.nix | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'nixos') 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 + ''; } -- cgit 1.4.1