diff options
author | Jörg Thalheim <Mic92@users.noreply.github.com> | 2017-09-15 16:19:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-15 16:19:11 +0100 |
commit | 7d5633ea7a3846166ea5cc40d3ea701aef86aad8 (patch) | |
tree | a9023989c74ab23c58e588ed6a843d014c77c81f /nixos/modules/installer/tools | |
parent | 6dad1f70ce5a7788bfd1487c8ecbc0036a34ddf8 (diff) | |
parent | 77ce02201e1bc7facabb774d7e9996ab803145d2 (diff) | |
download | nixlib-7d5633ea7a3846166ea5cc40d3ea701aef86aad8.tar nixlib-7d5633ea7a3846166ea5cc40d3ea701aef86aad8.tar.gz nixlib-7d5633ea7a3846166ea5cc40d3ea701aef86aad8.tar.bz2 nixlib-7d5633ea7a3846166ea5cc40d3ea701aef86aad8.tar.lz nixlib-7d5633ea7a3846166ea5cc40d3ea701aef86aad8.tar.xz nixlib-7d5633ea7a3846166ea5cc40d3ea701aef86aad8.tar.zst nixlib-7d5633ea7a3846166ea5cc40d3ea701aef86aad8.zip |
Merge pull request #27342 from lheckemann/installer-changes
Installer changes
Diffstat (limited to 'nixos/modules/installer/tools')
-rw-r--r-- | nixos/modules/installer/tools/nixos-install.sh | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/nixos/modules/installer/tools/nixos-install.sh b/nixos/modules/installer/tools/nixos-install.sh index 087fbcd4512f..79ed18c923c0 100644 --- a/nixos/modules/installer/tools/nixos-install.sh +++ b/nixos/modules/installer/tools/nixos-install.sh @@ -106,8 +106,11 @@ extraBuildFlags+=(--option "build-users-group" "$buildUsersGroup") binary_caches="$(@perl@/bin/perl -I @nix@/lib/perl5/site_perl/*/* -e 'use Nix::Config; Nix::Config::readConfig; print $Nix::Config::config{"binary-caches"};')" extraBuildFlags+=(--option "binary-caches" "$binary_caches") -nixpkgs="$(readlink -f "$(nix-instantiate --find-file nixpkgs)")" -export NIX_PATH="nixpkgs=$nixpkgs:nixos-config=$mountPoint/$NIXOS_CONFIG" +# We only need nixpkgs in the path if we don't already have a system closure to install +if [[ -z "$closure" ]]; then + nixpkgs="$(readlink -f "$(nix-instantiate --find-file nixpkgs)")" + export NIX_PATH="nixpkgs=$nixpkgs:nixos-config=$mountPoint/$NIXOS_CONFIG" +fi unset NIXOS_CONFIG # TODO: do I need to set NIX_SUBSTITUTERS here or is the --option binary-caches above enough? @@ -123,6 +126,9 @@ function closure() { } system_closure="$tmpdir/system.closure" +# Use a FIFO for piping nix-store --export into nix-store --import, saving disk +# I/O and space. nix-store --import is run by nixos-prepare-root. +mkfifo $system_closure if [ -z "$closure" ]; then expr="(import <nixpkgs/nixos> {}).system" @@ -132,7 +138,9 @@ else system_root=$closure # Create a temporary file ending in .closure (so nixos-prepare-root knows to --import it) to transport the store closure # to the filesytem we're preparing. Also delete it on exit! - nix-store --export $(nix-store -qR $closure) > $system_closure + # Run in background to avoid blocking while trying to write to the FIFO + # $system_closure refers to + nix-store --export $(nix-store -qR $closure) > $system_closure & fi channel_root="$(nix-env -p /nix/var/nix/profiles/per-user/root/channels -q nixos --no-name --out-path 2>/dev/null || echo -n "")" |