Skip to content

Commit

Permalink
home-manager: fix home-manager build error (#2514)
Browse files Browse the repository at this point in the history
Two misplaced quotations were introduced in `doBuild` by #2501, which
caused the parameter expansion of DRY_RUN to include an extraneous tab. Since the flake uri is passed
later into the command, Nix assumes the whitespace sequence as the flake uri and returns that it is not
a valid flake reference.

This PR removes the misplaced quotations in `doBuild` and also places the flake uri as the first argument for
calls to `doBuildFlake` for consistency with `doBuildAttr`. Placing the uri first in the command line also guards
against possible security issues if arbitrary uris are expanded prior to the user given uri.

(cherry picked from commit 9de7722)
  • Loading branch information
polykernel authored and rycee committed Dec 2, 2021
1 parent 3e93c4e commit 9437177
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions home-manager/home-manager
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,9 @@ function doBuild() {
setFlakeAttribute
if [[ -v FLAKE_CONFIG_URI ]]; then
doBuildFlake \
"${DRY_RUN+--dry-run} \
"${NO_OUT_LINK+--no-link} \
"$FLAKE_CONFIG_URI.activationPackage" \
${DRY_RUN+--dry-run} \
${NO_OUT_LINK+--no-link} \
|| return
else
doBuildAttr \
Expand Down Expand Up @@ -294,8 +294,8 @@ function doSwitch() {
setFlakeAttribute
if [[ -v FLAKE_CONFIG_URI ]]; then
doBuildFlake \
--out-link "$generation" \
"$FLAKE_CONFIG_URI.activationPackage" \
--out-link "$generation" \
&& "$generation/activate" || return
else
doBuildAttr \
Expand Down

0 comments on commit 9437177

Please sign in to comment.