From fe6b0b15e6f4a346a204f72310e0914ba7edc941 Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Wed, 11 Mar 2015 16:44:31 +0000 Subject: [PATCH] nixos-install: support -j, --cores and --option. Closes #6755 --- nixos/doc/manual/man-nixos-install.xml | 47 +++++++++++++++++++ .../modules/installer/tools/nixos-install.sh | 11 +++-- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/nixos/doc/manual/man-nixos-install.xml b/nixos/doc/manual/man-nixos-install.xml index 06e7b4a9847..7ad1be1ec10 100644 --- a/nixos/doc/manual/man-nixos-install.xml +++ b/nixos/doc/manual/man-nixos-install.xml @@ -25,6 +25,22 @@ root + + + + + + number + + + + number + + + + name + value + @@ -96,6 +112,37 @@ it. + + + + Sets the maximum number of build jobs that Nix will + perform in parallel to the specified number. The default is 1. + A higher value is useful on SMP systems or to exploit I/O latency. + + + + + + + Sets the value of the NIX_BUILD_CORES + environment variable in the invocation of builders. Builders can + use this variable at their discretion to control the maximum amount + of parallelism. For instance, in Nixpkgs, if the derivation + attribute enableParallelBuilding is set to + true, the builder passes the + flag to GNU Make. + The value 0 means that the builder should use all + available CPU cores in the system. + + + + name value + + Set the Nix configuration option + name to value. + + + diff --git a/nixos/modules/installer/tools/nixos-install.sh b/nixos/modules/installer/tools/nixos-install.sh index bfb42d40b06..14ae3daace0 100644 --- a/nixos/modules/installer/tools/nixos-install.sh +++ b/nixos/modules/installer/tools/nixos-install.sh @@ -28,9 +28,14 @@ chrootCommand=(/run/current-system/sw/bin/bash) while [ "$#" -gt 0 ]; do i="$1"; shift 1 case "$i" in - -I) - given_path="$1"; shift 1 - extraBuildFlags+=("$i" "$given_path") + --max-jobs|-j|--cores|-I) + j="$1"; shift 1 + extraBuildFlags+=("$i" "$j") + ;; + --option) + j="$1"; shift 1 + k="$1"; shift 1 + extraBuildFlags+=("$i" "$j" "$k") ;; --root) mountPoint="$1"; shift 1