@@ -313,6 +313,11 @@ parseArgs() {
313
313
echo ' For example, to use the output nixosConfigurations.foo from the flake.nix, append "#foo" to the flake-uri.' >&2
314
314
exit 1
315
315
fi
316
+
317
+ # Support .#foo shorthand
318
+ if [[ $flakeAttr != nixosConfigurations.* ]]; then
319
+ flakeAttr=" nixosConfigurations.\" $flakeAttr \" .config"
320
+ fi
316
321
fi
317
322
318
323
}
@@ -363,7 +368,7 @@ runVmTest() {
363
368
--no-link \
364
369
-L \
365
370
" ${nixOptions[@]} " \
366
- " ${flake} #nixosConfigurations. \" ${flakeAttr} \" .config .system.build.installTest"
371
+ " ${flake} #${flakeAttr} .system.build.installTest"
367
372
}
368
373
369
374
uploadSshKey () {
@@ -539,11 +544,11 @@ runDisko() {
539
544
step Building disko script
540
545
# We need to do a nix copy first because nix build doesn't have --no-check-sigs
541
546
# Use ssh:// here to avoid https://github.com/NixOS/nix/issues/7359
542
- nixCopy --to " ssh://$sshConnection " " ${flake} #nixosConfigurations. \" ${flakeAttr} \" .config .system.build.${diskoMode} Script" \
547
+ nixCopy --to " ssh://$sshConnection " " ${flake} #${flakeAttr} .system.build.${diskoMode} Script" \
543
548
--derivation --no-check-sigs
544
549
# If we don't use ssh-ng here, we get `error: operation 'getFSAccessor' is not supported by store`
545
550
diskoScript=$(
546
- nixBuild " ${flake} #nixosConfigurations. \" ${flakeAttr} \" .config .system.build.${diskoMode} Script" \
551
+ nixBuild " ${flake} #${flakeAttr} .system.build.${diskoMode} Script" \
547
552
--eval-store auto --store " ssh-ng://$sshConnection ?ssh-key=$sshKeyDir /nixos-anywhere"
548
553
)
549
554
fi
@@ -561,11 +566,11 @@ nixosInstall() {
561
566
step Building the system closure
562
567
# We need to do a nix copy first because nix build doesn't have --no-check-sigs
563
568
# Use ssh:// here to avoid https://github.com/NixOS/nix/issues/7359
564
- nixCopy --to " ssh://$sshConnection ?remote-store=local?root=/mnt" " ${flake} #nixosConfigurations. \" ${flakeAttr} \" .config .system.build.toplevel" \
569
+ nixCopy --to " ssh://$sshConnection ?remote-store=local?root=/mnt" " ${flake} #${flakeAttr} .system.build.toplevel" \
565
570
--derivation --no-check-sigs
566
571
# If we don't use ssh-ng here, we get `error: operation 'getFSAccessor' is not supported by store`
567
572
nixosSystem=$(
568
- nixBuild " ${flake} #nixosConfigurations. \" ${flakeAttr} \" .config .system.build.toplevel" \
573
+ nixBuild " ${flake} #${flakeAttr} .system.build.toplevel" \
569
574
--eval-store auto --store " ssh-ng://$sshConnection ?ssh-key=$sshKeyDir /nixos-anywhere&remote-store=local?root=/mnt"
570
575
)
571
576
fi
@@ -626,9 +631,9 @@ main() {
626
631
if [[ -n ${flake} ]]; then
627
632
if [[ ${buildOnRemote} == " n" ]] && [[ ${hardwareConfigBackend} == " none" ]]; then
628
633
if [[ ${phases[disko]} == 1 ]]; then
629
- diskoScript=$( nixBuild " ${flake} #nixosConfigurations. \" ${flakeAttr} \" .config .system.build.${diskoMode} Script" )
634
+ diskoScript=$( nixBuild " ${flake} #${flakeAttr} .system.build.${diskoMode} Script" )
630
635
fi
631
- nixosSystem=$( nixBuild " ${flake} #nixosConfigurations. \" ${flakeAttr} \" .config .system.build.toplevel" )
636
+ nixosSystem=$( nixBuild " ${flake} #${flakeAttr} .system.build.toplevel" )
632
637
fi
633
638
elif [[ -n ${diskoScript} ]] && [[ -n ${nixosSystem} ]]; then
634
639
if [[ ! -e ${diskoScript} ]] || [[ ! -e ${nixosSystem} ]]; then
@@ -684,9 +689,9 @@ main() {
684
689
685
690
if [[ ${buildOnRemote} == " n" ]] && [[ -n ${flake} ]] && [[ ${hardwareConfigBackend} != " none" ]]; then
686
691
if [[ ${phases[disko]} == 1 ]]; then
687
- diskoScript=$( nixBuild " ${flake} #nixosConfigurations. \" ${flakeAttr} \" .config .system.build.${diskoMode} Script" )
692
+ diskoScript=$( nixBuild " ${flake} #${flakeAttr} .system.build.${diskoMode} Script" )
688
693
fi
689
- nixosSystem=$( nixBuild " ${flake} #nixosConfigurations. \" ${flakeAttr} \" .config .system.build.toplevel" )
694
+ nixosSystem=$( nixBuild " ${flake} #${flakeAttr} .system.build.toplevel" )
690
695
fi
691
696
692
697
# Installation will fail if non-root user is used for installer.
0 commit comments