From 1908cd711742abcf05deb19c0d77c642a28e260a Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Feb 2020 09:59:15 +0100 Subject: taalo-build: Combine ssh and ssh-ng store protocol For some reason which I haven't been able to debug yet, the legacy SSH remote store protocol is way faster when it comes to copying files. To cope with this for now, we now use the legacy protocol for copying and the new protocol for the actual remote build. Signed-off-by: aszlig --- pkgs/taalo-build/default.nix | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'pkgs/taalo-build') diff --git a/pkgs/taalo-build/default.nix b/pkgs/taalo-build/default.nix index 09ff41d4..1c24b316 100644 --- a/pkgs/taalo-build/default.nix +++ b/pkgs/taalo-build/default.nix @@ -1,20 +1,25 @@ -{ stdenv, lib, runCommandLocal, coreutils, nixUnstable }: +{ stdenv, lib, runCommandLocal, coreutils, nix }: let - nixRemote = "ssh-ng://nix-remote-build@taalo.headcounter.org?compress=true"; - remoteEsc = lib.escapeShellArg nixRemote; - mkNix = cmd: lib.escapeShellArg "${nixUnstable}/bin/${cmd}"; + mkNixRemote = proto: let + hostAndQuery = "nix-remote-build@taalo.headcounter.org?compress=true"; + in "${proto}://${hostAndQuery}"; + + remoteCopyEsc = lib.escapeShellArg (mkNixRemote "ssh"); + remoteEsc = lib.escapeShellArg (mkNixRemote "ssh-ng"); + mkNix = cmd: lib.escapeShellArg "${nix}/bin/${cmd}"; errorOnly = cmd: "if ! outerr=\"$(${cmd} 2>&1)\"; then echo \"$outerr\" >&2; exit 1; fi"; remoteRealize = pre: arg: '' - ${errorOnly "${mkNix "nix"} copy -s --quiet --to ${remoteEsc} ${arg}"} + ${errorOnly "${mkNix "nix"} copy -s --quiet --to ${remoteCopyEsc} ${arg}"} NIX_REMOTE=${remoteEsc} ${pre}${mkNix "nix-store"} -r ${arg} ''; - emitScript = content: - "echo -n ${lib.escapeShellArg "#!${stdenv.shell}\nset -e\n${content}"}"; + emitScript = content: let + result = "#!${stdenv.shell}\nset -e\n${content}"; + in "echo -n ${lib.escapeShellArg result}"; in runCommandLocal "taalo-build" {} '' mkdir -p "$out/bin" -- cgit 1.4.1