forked from Fediversity/Fediversity
switch reusable script to package, facilitating inspection and reuse
This commit is contained in:
parent
35b6c1c453
commit
ae16beeb87
2 changed files with 7 additions and 6 deletions
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue