at 17.09-beta 1.3 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 pkgs2storeContents = l : map (x: { object = x; symlink = "none"; }) l; 7 8in { 9 # Docker image config. 10 imports = [ 11 ../installer/cd-dvd/channel.nix 12 ./minimal.nix 13 ./clone-config.nix 14 ]; 15 16 # Create the tarball 17 system.build.tarball = import ../../lib/make-system-tarball.nix { 18 inherit (pkgs) stdenv perl xz pathsFromGraph; 19 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 38 # database. 39 if [ -f /nix-path-registration ]; then 40 ${config.nix.package.out}/bin/nix-store --load-db < /nix-path-registration && 41 rm /nix-path-registration 42 fi 43 44 # nixos-rebuild also requires a "system" profile 45 ${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system 46 ''; 47 48 # Install new init script 49 system.activationScripts.installInitScript = '' 50 ln -fs $systemConfig/init /init 51 ''; 52}