1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 21:49:48 +01:00

home-manager: add --no-out-link command line option

When this option is used then `home-manager build` will not produce a
`result` link in the current working directory.
This commit is contained in:
Sandro Jäckel 2021-07-26 14:58:26 +02:00 committed by Robert Helgesson
parent addc78bea0
commit f00b7fff53
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
5 changed files with 31 additions and 3 deletions

View file

@ -155,6 +155,10 @@
--(no-)substitute --(no-)substitute
</arg> </arg>
<arg>
--no-out-link
</arg>
<arg> <arg>
<group choice="req"> <group choice="req">
<arg choice="plain"> <arg choice="plain">
@ -536,6 +540,19 @@
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>
<option>--no-out-link</option>
</term>
<listitem>
<para>
Passed on to <citerefentry>
<refentrytitle>nix-build</refentrytitle>
<manvolnum>1</manvolnum> </citerefentry>
when running <command>home-manager build</command>.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<option>-v</option> <option>-v</option>

View file

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

View file

@ -60,3 +60,4 @@ complete -c home-manager -x -l "option" -d "Set Nix configuration option"
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"
complete -c home-manager -f -l "no-out-link"

View file

@ -48,6 +48,7 @@ case "$state" in
'--keep-failed[keep failed]' \ '--keep-failed[keep failed]' \
'--keep-going[keep going]' \ '--keep-going[keep going]' \
'--max-jobs[max jobs]:NUM:()' \ '--max-jobs[max jobs]:NUM:()' \
'--no-out-link[no out link]' \
'--no-substitute[no substitute]' \ '--no-substitute[no substitute]' \
'--option[option]:NAME VALUE:()' \ '--option[option]:NAME VALUE:()' \
'--show-trace[show trace]' \ '--show-trace[show trace]' \

View file

@ -252,6 +252,7 @@ function doBuild() {
nix build \ nix build \
"${PASSTHROUGH_OPTS[@]}" \ "${PASSTHROUGH_OPTS[@]}" \
${DRY_RUN+--dry-run} \ ${DRY_RUN+--dry-run} \
${NO_OUT_LINK+--no-out-link} \
"$FLAKE_CONFIG_URI.activationPackage" \ "$FLAKE_CONFIG_URI.activationPackage" \
|| exitCode=1 || exitCode=1
return $exitCode return $exitCode
@ -263,8 +264,9 @@ function doBuild() {
newsInfo=$(buildNews) newsInfo=$(buildNews)
local exitCode local exitCode
doBuildAttr \
doBuildAttr --attr activationPackage \ ${NO_OUT_LINK+--no-out-link} \
--attr activationPackage \
&& exitCode=0 || exitCode=1 && exitCode=0 || exitCode=1
presentNews "$newsInfo" presentNews "$newsInfo"
@ -520,6 +522,7 @@ function doHelp() {
echo " --option NAME VALUE" echo " --option NAME VALUE"
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 echo
echo "Commands" echo "Commands"
echo echo
@ -601,6 +604,9 @@ while [[ $# -gt 0 ]]; do
PASSTHROUGH_OPTS+=("$opt" "$1" "$2") PASSTHROUGH_OPTS+=("$opt" "$1" "$2")
shift 2 shift 2
;; ;;
--no-out-link)
NO_OUT_LINK=1
;;
-h|--help) -h|--help)
doHelp doHelp
exit 0 exit 0
@ -695,3 +701,5 @@ case $COMMAND in
exit 1 exit 1
;; ;;
esac esac
# vim: ft=bash