4 inherit (pkgs) writeScript;
6 pkgs2storeContents = map (x: { object = x; symlink = "none"; });
10 # Docker image config.
12 ../installer/cd-dvd/channel.nix
18 system.build.tarball = pkgs.callPackage ../../lib/make-system-tarball.nix {
21 source = "${config.system.build.toplevel}/.";
25 extraArgs = "--owner=0";
27 # Add init script to image
28 storeContents = pkgs2storeContents [
29 config.system.build.toplevel
33 # Some container managers like lxc need these
35 let script = writeScript "extra-commands.sh" ''
37 mkdir -p proc sys dev etc
42 boot.isContainer = true;
43 boot.postBootCommands =
45 # After booting, register the contents of the Nix store in the Nix
47 if [ -f /nix-path-registration ]; then
48 ${config.nix.package.out}/bin/nix-store --load-db < /nix-path-registration &&
49 rm /nix-path-registration
52 # nixos-rebuild also requires a "system" profile
53 ${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
56 # Install new init script
57 system.activationScripts.installInitScript = ''
58 ln -fs $systemConfig/init /init