From 9fbc2ee11f47810a58ce2c96ae51c2969f974fa1 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 12 Nov 2026 01:20:02 +0000 Subject: krops writeDeploy: pass --no-flake if /etc/nixos/flake.nix exists nixos-rebuild deploys /etc/nixos/flake.nix instead of NIX_PATH if that file exists, so deploying anything but a flake fails on such targets. Without writeDeploy's flake parameter, nixos-rebuild gets --no-flake if /etc/nixos/flake.nix exists on the build target. nixos-rebuild versions predating flakes neither know --no-flake nor look for that file, so they don't get it. The deploy VM test covers targets with and without that file. --- pkgs/krops/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pkgs') diff --git a/pkgs/krops/default.nix b/pkgs/krops/default.nix index 429fc61..e4f72cd 100644 --- a/pkgs/krops/default.nix +++ b/pkgs/krops/default.nix @@ -16,7 +16,10 @@ in NIX_PATH=${lib.escapeShellArg target.path} \ nixos-rebuild ${lib.escapeShellArgs (args ++ lib.optionals (flake != null) [ "--flake" "${target.path}/${flake}" - ])} + ])} ${lib.optionalString (flake == null) + # nixos-rebuild deploys /etc/nixos/flake.nix if it exists. Any + # nixos-rebuild doing so supports --no-flake. + "$(test -e /etc/nixos/flake.nix && echo --no-flake)"} ''); runShell = target: { -- cgit v1.3.1