1 { config, lib, pkgs, ... }:
5 let inherit (pkgs) writeScript; in
8 pkgs2storeContents = l : map (x: { object = x; symlink = "none"; }) l;
11 # Docker image config.
13 ../installer/cd-dvd/channel.nix
19 system.build.tarball = pkgs.callPackage ../../lib/make-system-tarball.nix {
22 source = "${config.system.build.toplevel}/.";
26 extraArgs = "--owner=0";
28 # Add init script to image
29 storeContents = pkgs2storeContents [
30 config.system.build.toplevel
34 # Some container managers like lxc need these
36 let script = writeScript "extra-commands.sh" ''
38 mkdir -p proc sys dev etc
43 boot.isContainer = true;
44 boot.postBootCommands =
46 # After booting, register the contents of the Nix store in the Nix
48 if [ -f /nix-path-registration ]; then
49 ${config.nix.package.out}/bin/nix-store --load-db < /nix-path-registration &&
50 rm /nix-path-registration
53 # nixos-rebuild also requires a "system" profile
54 ${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
57 # Install new init script
58 system.activationScripts.installInitScript = ''
59 ln -fs $systemConfig/init /init