git.iko.soy/typeable/nixpkgs
on master help sign in
nixos: container profile, update /init symlink on rebuild
commitf2e20fa83729981c679b4dfb1689db8ca3f70ec7 authorJaka Hudoklin <jakahudoklin@gmail.com> dateFri 12 Dec 2014, 02:54 (12 years ago) parent1f9acba
1 file changed+8−7
nixos/modules/profiles/container.nix+8−7
nixos/modules/profiles/container.nix+8−7
@@ -20,17 +20,18 @@ in {
2020 contents = [];
2121 extraArgs = "--owner=0";
2222
23− # Some container managers like lxc need these
24− extraCommands = "mkdir -p proc sys dev";
25−
2623 # Add init script to image
2724 storeContents = [
2825 { object = config.system.build.toplevel + "/init";
2926 symlink = "/init";
3027 }
3128 ] ++ (pkgs2storeContents [ pkgs.stdenv ]);
29+
30+ # Some container managers like lxc need these
31+ extraCommands = "mkdir -p proc sys dev";
3232 };
3333
34+ boot.isContainer = true;
3435 boot.postBootCommands =
3536 ''
3637 # After booting, register the contents of the Nix store in the Nix
@@ -46,12 +47,12 @@ in {
4647 ${config.nix.package}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
4748 '';
4849
49− boot.isContainer = true;
50−
5150 # Disable some features that are not useful in a container.
5251 sound.enable = mkDefault false;
5352 services.udisks2.enable = mkDefault false;
5453
55− # Shut up warnings about not having a boot loader.
56− system.build.installBootLoader = "${pkgs.coreutils}/bin/true";
54+ # Install new init script
55+ system.activationScripts.installInitScript = ''
56+ ln -fs $systemConfig/init /init
57+ '';
5758}