From 716a7750d1c22c4b5d06140758616af322a7c56d Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Tue, 2 Sep 2025 22:28:12 +0200 Subject: [PATCH] feat: Add copy.substituteOnDestination --- modules/nixops4Resource/nixos.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/nixops4Resource/nixos.nix b/modules/nixops4Resource/nixos.nix index 79f0def..769f568 100644 --- a/modules/nixops4Resource/nixos.nix +++ b/modules/nixops4Resource/nixos.nix @@ -46,6 +46,15 @@ in type = types.str; default = ""; }; + copy.substituteOnDestination = mkOption { + type = types.bool; + default = true; + description = '' + Whether to try substitutes on the destination store when copying. + This may be faster if the link between the local and remote machines is + slower than the link between the remote machine and its substituters. + ''; + }; sudo.enable = mkOption { type = types.bool; default = config.ssh.user != "root"; @@ -84,7 +93,7 @@ in ${config.ssh.host} ${config.ssh.hostPublicKey} '' } "${lib.strings.escapeShellArg "${config.ssh.opts}"} - nix copy --to "ssh-ng://$0" "$1" --no-check-sigs --extra-experimental-features nix-command + nix copy --to "ssh-ng://$0" "$1" --no-check-sigs --extra-experimental-features nix-command${lib.optionalString config.copy.substituteOnDestination " --substitute-on-destination"} ssh $NIX_SSHOPTS "$0" "${lib.optionalString config.sudo.enable "sudo "}$1/bin/apply switch" '' (lib.optionalString (config.ssh.user != null) "${config.ssh.user}@" + config.ssh.host)