added: adapt modules

This commit is contained in:
shimun 2022-12-24 17:17:20 +01:00
parent 991dbaeec9
commit 0f6e2e0d40
Signed by: shimun
GPG Key ID: E0420647856EA39E
4 changed files with 9 additions and 8 deletions

View File

@ -4,7 +4,9 @@ version = "0.1.0"
authors = ["shimun <shimun@shimun.net>"] authors = ["shimun <shimun@shimun.net>"]
edition = "2021" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [[bin]]
name = "ssh-cert-dist"
path = "src/main.rs"
[dependencies] [dependencies]
anyhow = "1.0.66" anyhow = "1.0.66"

View File

@ -13,15 +13,14 @@ in
Environment = "RUST_LOG=debug"; Environment = "RUST_LOG=debug";
ExecStart = toString (pkgs.writeShellApplication { ExecStart = toString (pkgs.writeShellApplication {
name = "ssh-cert-dist-${options.name}"; name = "ssh-cert-dist-${options.name}";
runtimeInputs = [ pkgs.ssh-cert-dist ]; runtimeInputs = [ cfg.package ];
text = '' text = ''
${optionalString options.fetch '' ${optionalString options.fetch ''
ssh-cert-dist client fetch --cert-dir '${path}' --api-endpoint '${cfg.endpoint}' ssh-cert-dist fetch --cert-dir '${path}' --api-endpoint '${cfg.endpoint}'
''} ''}
${optionalString options.upload '' ${optionalString options.upload ''
ssh-cert-dist client upload --api-endpoint '${cfg.endpoint}' ${path}/* ssh-cert-dist upload --api-endpoint '${cfg.endpoint}' ${path}/*
''} ''}
''; '';
}); });
}; };

View File

@ -14,7 +14,7 @@ in
}; };
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.ssh-cert-dist; default = pkgs.ssh-cert-dist-server;
}; };
ca = mkOption { ca = mkOption {
type = types.path; type = types.path;
@ -57,7 +57,7 @@ in
chown ${cfg.user}:${cfg.group} ${cfg.dataDir} chown ${cfg.user}:${cfg.group} ${cfg.dataDir}
''}"; ''}";
User = cfg.user; User = cfg.user;
ExecStart = "${cfg.package}/bin/ssh-cert-dist server"; ExecStart = "${cfg.package}/bin/ssh-cert-dist-server";
}; };
}; };
}; };

View File

@ -22,7 +22,7 @@
}; };
packageOption = mkOption { packageOption = mkOption {
type = types.package; type = types.package;
default = pkgs.ssh-cert-dist; default = pkgs.ssh-cert-dist-client;
}; };
in in