have tf test also use package

Signed-off-by: Kiara Grouwstra <kiara@procolix.eu>
This commit is contained in:
Kiara Grouwstra 2025-09-03 15:08:09 +02:00
parent 1addef3fc5
commit 8113ec70ce
Signed by: kiara
SSH key fingerprint: SHA256:COspvLoLJ5WC5rFb9ZDe5urVCkK4LJZOsjfF4duRJFU
2 changed files with 6 additions and 5 deletions

View file

@ -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
})."tf-deployment".tf-host;
})."tf-deployment".tf-host.run;
in
{
_class = "nixosTest";
@ -39,6 +39,7 @@ in
environment.systemPackages = with pkgs; [
(pkgs.callPackage ../../run/tf-single-host/tf.nix { })
jq
deploy
];
# needed only when building from deployer
@ -57,7 +58,7 @@ in
with subtest("ssh: Run the deployment"):
deployer.succeed("""
${deployment.run}
${lib.getExe deploy}
""")
target.wait_for_unit("multi-user.target")
target.succeed("su - operator -c hello 1>&2")

View file

@ -186,7 +186,7 @@ let
type = types.path;
};
run = mkOption {
type = types.str;
type = types.package;
# error: The option `tf-deployment.tf-host.run' is read-only, but it's set multiple times.
# readOnly = true;
default =
@ -221,7 +221,7 @@ let
};
tf-env = pkgs.callPackage ./run/tf-single-host/tf-env.nix { };
in
''
pkgs.writeShellScriptBin "deploy-ssh.sh" ''
env ${toString (lib.mapAttrsToList (k: v: "TF_VAR_${k}=\"${toBash v}\"") environment)} \
tf_env=${tf-env} bash ./deployment/run/tf-single-host/run.sh
'';