mirror of
https://github.com/nix-community/nixos-generators.git
synced 2024-08-16 07:30:22 +03:00
nix-build: add --cores parameter
This commit is contained in:
parent
c54ce47d5d
commit
223d5c0579
@ -9,6 +9,7 @@ configuration=${NIXOS_CONFIG:-$libexec_dir/configuration.nix}
|
||||
format=
|
||||
format_dir=$libexec_dir/formats
|
||||
target_system=
|
||||
cores=
|
||||
run=
|
||||
|
||||
## Functions
|
||||
@ -28,6 +29,7 @@ Options:
|
||||
* --run: runs the configuration in a VM
|
||||
only works for the "vm" and "vm-no-gui" formats
|
||||
* --system: specify the target system (eg: x86_64-linux)
|
||||
* --cores : to control the maximum amount of parallelism. (see nix-build documentation)
|
||||
USAGE
|
||||
}
|
||||
|
||||
@ -50,6 +52,10 @@ while [[ $# -gt 0 ]]; do
|
||||
configuration=$2
|
||||
shift
|
||||
;;
|
||||
--cores)
|
||||
cores=$2
|
||||
shift
|
||||
;;
|
||||
-f | --format)
|
||||
format=$format_dir/$2.nix
|
||||
shift
|
||||
@ -98,6 +104,10 @@ if [[ -n $target_system ]]; then
|
||||
args+=(--argstr system "$target_system")
|
||||
fi
|
||||
|
||||
if [[ -n $cores ]]; then
|
||||
args+=(--cores "$cores")
|
||||
fi
|
||||
|
||||
formatAttr=$(nix-instantiate "${args[@]}" --eval --json -A config.formatAttr | jq -r .)
|
||||
|
||||
out=$(nix-build "${args[@]}" --no-out-link -A "config.system.build.$formatAttr")
|
||||
|
Loading…
Reference in New Issue
Block a user