1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-14 02:33:38 +02:00

home-manager: pass -L/--print-build-logs to nix build

When building from a flake, `nix build` hides the build output by
default, with a `-L`/`--print-build-logs` option to show it. Pass this
option along from `home-manager` if the user provides it.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
(cherry picked from commit c55fa26ce0)
This commit is contained in:
Anders Kaseorg 2022-12-24 22:48:45 -08:00 committed by Robert Helgesson
parent 6b8836ce6c
commit 89a8ba0b5b
No known key found for this signature in database
GPG Key ID: 36BDAA14C2797E89
5 changed files with 37 additions and 0 deletions

View File

@ -155,6 +155,18 @@
--keep-going --keep-going
</arg> </arg>
<arg>
<group choice="req">
<arg choice="plain">
-L
</arg>
<arg choice="plain">
--print-build-logs
</arg>
</group>
</arg>
<arg> <arg>
--show-trace --show-trace
</arg> </arg>
@ -546,6 +558,22 @@
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>
<option>-L</option>
</term>
<term>
<option>--print-build-logs</option>
</term>
<listitem>
<para>
Passed on to <citerefentry>
<refentrytitle>nix build</refentrytitle>
</citerefentry>
when building from a flake.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<option>--show-trace</option> <option>--show-trace</option>

View File

@ -293,6 +293,7 @@ _home-manager_completions ()
Options=( "-f" "--file" "-b" "-A" "-I" "-h" "--help" "-n" "--dry-run" "-v" \ Options=( "-f" "--file" "-b" "-A" "-I" "-h" "--help" "-n" "--dry-run" "-v" \
"--verbose" "--cores" "--debug" "--impure" "--keep-failed" \ "--verbose" "--cores" "--debug" "--impure" "--keep-failed" \
"--keep-going" "-j" "--max-jobs" "--no-substitute" "--no-out-link" \ "--keep-going" "-j" "--max-jobs" "--no-substitute" "--no-out-link" \
"-L" "--print-build-logs" \
"--show-trace" "--substitute" "--builders" "--version" \ "--show-trace" "--substitute" "--builders" "--version" \
"--update-input" "--override-input" "--experimental-features" \ "--update-input" "--override-input" "--experimental-features" \
"--extra-experimental-features" ) "--extra-experimental-features" )

View File

@ -60,6 +60,7 @@ complete -c home-manager -f -l "keep-going" -d "Keep going in case of failed bui
complete -c home-manager -x -s j -l "max-jobs" -d "Max number of build jobs in parallel" 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 "option" -d "Set Nix configuration option"
complete -c home-manager -x -l "builders" -d "Remote builders" complete -c home-manager -x -l "builders" -d "Remote builders"
complete -c home-manager -f -s L -l "print-build-logs" -d "Print full build logs on standard error"
complete -c home-manager -f -l "show-trace" -d "Print stack trace of evaluation errors" 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 "substitute"
complete -c home-manager -f -l "no-substitute" complete -c home-manager -f -l "no-substitute"

View File

@ -19,6 +19,7 @@ _arguments \
'(-j --max-jobs)'{--max-jobs,-j}'[max jobs]:NUM:()' \ '(-j --max-jobs)'{--max-jobs,-j}'[max jobs]:NUM:()' \
'--option[option]:NAME VALUE:()' \ '--option[option]:NAME VALUE:()' \
'--builders[builders]:SPEC:()' \ '--builders[builders]:SPEC:()' \
'(-L --print-build-logs)'{--print-build-logs,-L}'[print build logs]' \
'--show-trace[show trace]' \ '--show-trace[show trace]' \
'--override-input[override flake input]:NAME VALUE:()' \ '--override-input[override flake input]:NAME VALUE:()' \
'--update-input[update flake input]:NAME:()' \ '--update-input[update flake input]:NAME:()' \

View File

@ -289,6 +289,7 @@ function doBuild() {
"$FLAKE_CONFIG_URI.activationPackage" \ "$FLAKE_CONFIG_URI.activationPackage" \
${DRY_RUN+--dry-run} \ ${DRY_RUN+--dry-run} \
${NO_OUT_LINK+--no-link} \ ${NO_OUT_LINK+--no-link} \
${PRINT_BUILD_LOGS+--print-build-logs} \
|| return || return
else else
doBuildAttr \ doBuildAttr \
@ -319,6 +320,7 @@ function doSwitch() {
doBuildFlake \ doBuildFlake \
"$FLAKE_CONFIG_URI.activationPackage" \ "$FLAKE_CONFIG_URI.activationPackage" \
--out-link "$generation" \ --out-link "$generation" \
${PRINT_BUILD_LOGS+--print-build-logs} \
&& "$generation/activate" || return && "$generation/activate" || return
else else
doBuildAttr \ doBuildAttr \
@ -551,6 +553,7 @@ function doHelp() {
echo " --keep-going" echo " --keep-going"
echo " -j, --max-jobs NUM" echo " -j, --max-jobs NUM"
echo " --option NAME VALUE" echo " --option NAME VALUE"
echo " -L, --print-build-logs"
echo " --show-trace" echo " --show-trace"
echo " --(no-)substitute" echo " --(no-)substitute"
echo " --no-out-link Do not create a symlink to the output path" echo " --no-out-link Do not create a symlink to the output path"
@ -648,6 +651,9 @@ while [[ $# -gt 0 ]]; do
--no-out-link) --no-out-link)
NO_OUT_LINK=1 NO_OUT_LINK=1
;; ;;
-L|--print-build-logs)
PRINT_BUILD_LOGS=1
;;
-h|--help) -h|--help)
doHelp doHelp
exit 0 exit 0