Skip to content

Commit bef18c7

Browse files
committed
nixos-anywhere: run realpath after the outer folder exists
GNU realpath will fail if the outer folder doesn't exist so we wait until after we create the outer folder.
1 parent 1f2f362 commit bef18c7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/nixos-anywhere.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ parseArgs() {
201201
abort "Unknown hardware config backend: $2"
202202
;;
203203
esac
204-
hardwareConfigPath="$(realpath "$3")"
204+
hardwareConfigPath=$3
205205
shift
206206
shift
207207
;;
@@ -569,6 +569,8 @@ generateHardwareConfig() {
569569
570570
# to make sure nix knows about the new file
571571
if command -v git >/dev/null; then
572+
# handle relative paths
573+
hardwareConfigPath="$(realpath "$hardwareConfigPath")"
572574
pushd "$(dirname "$hardwareConfigPath")"
573575
if git rev-parse --is-inside-work-tree >/dev/null; then
574576
git add --intent-to-add --force -- "$hardwareConfigPath"

0 commit comments

Comments
 (0)