home-manager: fix home-manager build error (#2514)

Two misplaced quotations were introduced in `doBuild` by https://github.com/nix-community/home-manager/pull/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 9de77227d7)
This commit is contained in:
polykernel 2021-11-28 20:48:21 -05:00 committed by Robert Helgesson
parent 3e93c4e8b2
commit 9437177e82
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -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 \
@ -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 \