nixos-rebuild: fix creating ./result symlink for flakes

This commit is contained in:
Samuel Gräfenstein 2021-05-23 02:07:03 +02:00 committed by Jonathan Ringer
parent 0e98d7acab
commit ff3b3e696a

7
pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh Normal file → Executable file
View File

@ -210,7 +210,12 @@ nixBuild() {
}
nixFlakeBuild() {
if [ -z "$buildHost" ]; then
if [[ -z "$buildHost" && -z "$targetHost" ]] &&
! [ "$action" = switch -o "$action" = boot ]
then
nix "${flakeFlags[@]}" build "$@"
readlink -f ./result
elif [ -z "$buildHost" ]; then
nix "${flakeFlags[@]}" build "$@" --out-link "${tmpDir}/result"
readlink -f "${tmpDir}/result"
else