1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 19:49:45 +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
</arg>
<arg>
--no-out-link
</arg>
<arg>
<group choice="req">
<arg choice="plain">
@ -536,6 +540,19 @@
</para>
</listitem>
</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>
<term>
<option>-v</option>

View file

@ -291,7 +291,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" "--show-trace" "--substitute")
"--cores" "--debug" "--keep-failed" "--keep-going" "-j" "--max-jobs" \
"--no-substitute" "--no-out-link" "--show-trace" "--substitute")
# ^ « 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 "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-going[keep going]' \
'--max-jobs[max jobs]:NUM:()' \
'--no-out-link[no out link]' \
'--no-substitute[no substitute]' \
'--option[option]:NAME VALUE:()' \
'--show-trace[show trace]' \

View file

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