nixos: container profile, update /init symlink on rebuild

This commit is contained in:
Jaka Hudoklin 2014-12-12 02:54:53 +01:00
parent 1f9acba088
commit f2e20fa837
1 changed files with 8 additions and 7 deletions

View File

@ -20,17 +20,18 @@ in {
contents = []; contents = [];
extraArgs = "--owner=0"; extraArgs = "--owner=0";
# Some container managers like lxc need these
extraCommands = "mkdir -p proc sys dev";
# Add init script to image # Add init script to image
storeContents = [ storeContents = [
{ object = config.system.build.toplevel + "/init"; { object = config.system.build.toplevel + "/init";
symlink = "/init"; symlink = "/init";
} }
] ++ (pkgs2storeContents [ pkgs.stdenv ]); ] ++ (pkgs2storeContents [ pkgs.stdenv ]);
# Some container managers like lxc need these
extraCommands = "mkdir -p proc sys dev";
}; };
boot.isContainer = true;
boot.postBootCommands = boot.postBootCommands =
'' ''
# After booting, register the contents of the Nix store in the Nix # 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 ${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. # Disable some features that are not useful in a container.
sound.enable = mkDefault false; sound.enable = mkDefault false;
services.udisks2.enable = mkDefault false; services.udisks2.enable = mkDefault false;
# Shut up warnings about not having a boot loader. # Install new init script
system.build.installBootLoader = "${pkgs.coreutils}/bin/true"; system.activationScripts.installInitScript = ''
ln -fs $systemConfig/init /init
'';
} }