home-manager: allow remote builders for nix-build (#2268)

This allows running home-manager with --builders option passed through
to nix-build, which will then pass build execution to remote builders on
other machines.

This may be useful with relatively complex home-manager configurations
where building on a local machine is not feasible.
This commit is contained in:
Timur Demin 2021-08-18 01:53:44 +05:00 committed by GitHub
parent 5569770d1e
commit d11afee973
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 3 deletions

View File

@ -292,7 +292,8 @@ _home-manager_completions ()
local Options
Options=( "-f" "--file" "-b" "-A" "-I" "-h" "--help" "-n" "--dry-run" "-v" "--verbose" \
"--cores" "--debug" "--keep-failed" "--keep-going" "-j" "--max-jobs" \
"--no-substitute" "--no-out-link" "--show-trace" "--substitute")
"--no-substitute" "--no-out-link" "--show-trace" "--substitute" \
"--builders")
# ^ « home-manager »'s options.

View File

@ -57,6 +57,7 @@ complete -c home-manager -f -l "keep-failed" -d "Keep temporary directory used b
complete -c home-manager -f -l "keep-going" -d "Keep going in case of failed builds"
complete -c home-manager -x -s j -l "max-jobs" -d "Max number of build jobs in parallel"
complete -c home-manager -x -l "option" -d "Set Nix configuration option"
complete -c home-manager -x -l "builders" -d "Remote builders"
complete -c home-manager -f -l "show-trace" -d "Print stack trace of evaluation errors"
complete -c home-manager -f -l "substitute"
complete -c home-manager -f -l "no-substitute"

View File

@ -16,6 +16,7 @@ _arguments \
'(-f --file)'{--file,-f}'[configuration file]:FILE:_files' \
'(-j --max-jobs)'{--max-jobs,-j}'[max jobs]:NUM:()' \
'--option[option]:NAME VALUE:()' \
'--builders[builders]:SPEC:()' \
'--show-trace[show trace]' \
'1: :->cmds' \
'*:: :->args' && ret=0
@ -52,7 +53,8 @@ case "$state" in
'--no-substitute[no substitute]' \
'--option[option]:NAME VALUE:()' \
'--show-trace[show trace]' \
'--substitute[substitute]'
'--substitute[substitute]' \
'--builders[builders]:SPEC:()'
;;
esac
esac

View File

@ -523,6 +523,7 @@ function doHelp() {
echo " --show-trace"
echo " --(no-)substitute"
echo " --no-out-link Do not create a symlink to the output path"
echo " --builders VALUE"
echo
echo "Commands"
echo
@ -618,7 +619,7 @@ while [[ $# -gt 0 ]]; do
PASSTHROUGH_OPTS+=("$opt" "$1" "$2")
shift 2
;;
-j|--max-jobs|--cores)
-j|--max-jobs|--cores|--builders)
PASSTHROUGH_OPTS+=("$opt" "$1")
shift
;;