From 044a0d06c736e94dcbb33fd6ece6bfb5be15caff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Gr=C3=A4fenstein?= Date: Sun, 23 May 2021 02:07:03 +0200 Subject: [PATCH] nixos-rebuild: fix creating ./result symlink for flakes (cherry picked from commit 531dc2e0f12673cce9cc6ea3dc5fd8bfef39c9bf) --- pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) mode change 100644 => 100755 pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh diff --git a/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh b/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh old mode 100644 new mode 100755 index 2b94f18f538..890c070a27a --- a/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh +++ b/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh @@ -215,7 +215,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