nixos: container profile, update /init symlink on rebuild

+8 -7
+8 -7
nixos/modules/profiles/container.nix
··· 20 contents = []; 21 extraArgs = "--owner=0"; 22 23 - # Some container managers like lxc need these 24 - extraCommands = "mkdir -p proc sys dev"; 25 - 26 # Add init script to image 27 storeContents = [ 28 { object = config.system.build.toplevel + "/init"; 29 symlink = "/init"; 30 } 31 ] ++ (pkgs2storeContents [ pkgs.stdenv ]); 32 }; 33 34 boot.postBootCommands = 35 '' 36 # After booting, register the contents of the Nix store in the Nix ··· 46 ${config.nix.package}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system 47 ''; 48 49 - boot.isContainer = true; 50 - 51 # Disable some features that are not useful in a container. 52 sound.enable = mkDefault false; 53 services.udisks2.enable = mkDefault false; 54 55 - # Shut up warnings about not having a boot loader. 56 - system.build.installBootLoader = "${pkgs.coreutils}/bin/true"; 57 }
··· 20 contents = []; 21 extraArgs = "--owner=0"; 22 23 # Add init script to image 24 storeContents = [ 25 { object = config.system.build.toplevel + "/init"; 26 symlink = "/init"; 27 } 28 ] ++ (pkgs2storeContents [ pkgs.stdenv ]); 29 + 30 + # Some container managers like lxc need these 31 + extraCommands = "mkdir -p proc sys dev"; 32 }; 33 34 + boot.isContainer = true; 35 boot.postBootCommands = 36 '' 37 # After booting, register the contents of the Nix store in the Nix ··· 47 ${config.nix.package}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system 48 ''; 49 50 # Disable some features that are not useful in a container. 51 sound.enable = mkDefault false; 52 services.udisks2.enable = mkDefault false; 53 54 + # Install new init script 55 + system.activationScripts.installInitScript = '' 56 + ln -fs $systemConfig/init /init 57 + ''; 58 }