diff --git a/deployment/check/data-model-ssh/nixosTest.nix b/deployment/check/data-model-ssh/nixosTest.nix index cb27deaa..0e129493 100644 --- a/deployment/check/data-model-ssh/nixosTest.nix +++ b/deployment/check/data-model-ssh/nixosTest.nix @@ -15,12 +15,12 @@ let "ServerAliveInterval=1" ]; }; - deployment = + deploy = (import ../common/data-model.nix { inherit system; config = deployment-config; # opt not to pass `inputs`, as we could only pass serializable arguments through to its self-call - })."ssh-deployment".ssh-host; + })."ssh-deployment".ssh-host.run; in { _class = "nixosTest"; @@ -46,6 +46,7 @@ in { environment.systemPackages = with pkgs; [ jq + deploy ]; system.extraDependenciesFromModule = @@ -63,7 +64,7 @@ in with subtest("Run the deployment"): deployer.succeed(""" - ${deployment.run} + ${lib.getExe deploy} """) ssh.wait_for_unit("multi-user.target") ssh.succeed("su - operator -c hello 1>&2") diff --git a/deployment/data-model.nix b/deployment/data-model.nix index 6b50376b..6f85fb74 100644 --- a/deployment/data-model.nix +++ b/deployment/data-model.nix @@ -20,7 +20,7 @@ let ; toBash = v: - lib.replaceStrings [ "\"" ] [ "\\\\\"" ] ( + lib.replaceStrings [ "\"" ] [ "\\\"" ] ( if lib.isPath v || builtins.isNull v then toString v else if lib.isString v then @@ -112,7 +112,7 @@ let type = types.path; }; run = mkOption { - type = types.str; + type = types.package; # error: The option `ssh-deployment.ssh-host.run' is read-only, but it's set multiple times. # readOnly = true; default = @@ -146,7 +146,7 @@ let deployment_type = "ssh-host"; }; in - '' + pkgs.writeShellScriptBin "deploy-ssh.sh" '' env ${ toString (lib.mapAttrsToList (k: v: "${k}=\"${toBash v}\"") environment) } bash ./deployment/run/ssh-single-host/run.sh