summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2015-09-29 12:02:59 +0200
committerMatthias Beyer <mail@beyermatthias.de>2015-09-29 12:29:37 +0200
commitb9d88aab612126647c0586759a63d619a8eabd3d (patch)
treeb76cc464d8555a467b7fd39f9781b3075561b018
parent5f8353b3c62e8b42079069951997130ac8e4248b (diff)
update-package-def: Add -c option to pass --cores to nix-build
-rw-r--r--example.rc5
-rwxr-xr-xnix-script-update-package-def.sh19
2 files changed, 20 insertions, 4 deletions
diff --git a/example.rc b/example.rc
index fe1413c..7cf49d6 100644
--- a/example.rc
+++ b/example.rc
@@ -54,3 +54,8 @@ RC_CONTAINER_CONF_TEMPLATE_DIR=~/.nixos-scripts-container-conf-templates/
#
RC_UPD_NIX_BUILD_J=2
+#
+# default number to pass to "nix-build --cores"
+#
+RC_UPD_NIX_BUILD_CORES=2
+
diff --git a/nix-script-update-package-def.sh b/nix-script-update-package-def.sh
index fef66a3..bf6b448 100755
--- a/nix-script-update-package-def.sh
+++ b/nix-script-update-package-def.sh
@@ -12,7 +12,7 @@ source $(dirname ${BASH_SOURCE[0]})/nix-utils.sh
usage() {
cat <<EOS
- $(help_synopsis "${BASH_SOURCE[0]}" "[-y] [-b] [-c] [-g <nixpkgs path>] [-j <n>] -u <url>")
+ $(help_synopsis "${BASH_SOURCE[0]}" "[-y] [-b] [-c] [-g <nixpkgs path>] [-j <n>] [-C <n>] -u <url>")
-y Don't ask before executing things (optional) (not implemented yet)
-b Also test-build the package (optional)
@@ -21,6 +21,7 @@ usage() {
-c Don't check out another branch for update
-d Don't checkout base branch after successfull run.
-j <n> Pass "-j <n>" to nix-build
+ -C <n> Pass "--cores <n>" to nix-build
-h Show this help and exit
Helper for developers of Nix packages.
@@ -49,7 +50,8 @@ usage() {
nix-script -v update-package-def -b -u http://monitor.nixos.org/patch?p=ffmpeg-full&v=2.7.1&m=Matthias+Beyer
$(help_rcvars \
- "RC_UPD_NIX_BUILD_J - Default number to pass to 'nix-build -j'"
+ "RC_UPD_NIX_BUILD_J - Default number to pass to 'nix-build -j'"
+ "RC_UPD_NIX_BUILD_CORES - Default number to pass to 'nix-build --cores'"
)
$(help_end "${BASH_SOURCE[0]}")
@@ -63,8 +65,9 @@ URL=
CHECKOUT=1
DONT_CHECKOUT_BASE=
J="$RC_UPD_NIX_BUILD_J"
+CORES="$RC_UPD_NIX_BUILD_CORES"
-while getopts "ybu:g:cdj:h" OPTION
+while getopts "ybu:g:cdj:C:h" OPTION
do
case $OPTION in
y)
@@ -102,6 +105,11 @@ do
stderr "J = $J"
;;
+ C)
+ CORES="$OPTARG"
+ stderr "CORES = $CORES"
+ ;;
+
h)
usage
exit 0
@@ -174,7 +182,10 @@ then
__j=""
[[ ! -z "$J" ]] && __j="-j $J"
- ask_execute "Build '$PKG' in nixpkgs clone at '$NIXPKGS'" nix-build -A $PKG -I $NIXPKGS $__j
+ __cores=""
+ [[ ! -z "$CORES" ]] && __cores="-j $CORES"
+
+ ask_execute "Build '$PKG' in nixpkgs clone at '$NIXPKGS'" nix-build -A $PKG -I $NIXPKGS $__j $__cores
fi
#