1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-25 11:19:47 +01:00

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 setFlakeAttribute
if [[ -v FLAKE_CONFIG_URI ]]; then if [[ -v FLAKE_CONFIG_URI ]]; then
doBuildFlake \ doBuildFlake \
"${DRY_RUN+--dry-run} \
"${NO_OUT_LINK+--no-link} \
"$FLAKE_CONFIG_URI.activationPackage" \ "$FLAKE_CONFIG_URI.activationPackage" \
${DRY_RUN+--dry-run} \
${NO_OUT_LINK+--no-link} \
|| return || return
else else
doBuildAttr \ doBuildAttr \
@ -294,8 +294,8 @@ function doSwitch() {
setFlakeAttribute setFlakeAttribute
if [[ -v FLAKE_CONFIG_URI ]]; then if [[ -v FLAKE_CONFIG_URI ]]; then
doBuildFlake \ doBuildFlake \
--out-link "$generation" \
"$FLAKE_CONFIG_URI.activationPackage" \ "$FLAKE_CONFIG_URI.activationPackage" \
--out-link "$generation" \
&& "$generation/activate" || return && "$generation/activate" || return
else else
doBuildAttr \ doBuildAttr \