types.secret-file: add service option
This commit is contained in:
parent
087fff54f1
commit
b5b90b5984
@ -115,8 +115,12 @@ let
|
|||||||
}));
|
}));
|
||||||
systemd.services = mkIf (cfg.dkim != []) {
|
systemd.services = mkIf (cfg.dkim != []) {
|
||||||
exim = {
|
exim = {
|
||||||
after = [ "secret.service" ];
|
after = flip map cfg.dkim (dkim:
|
||||||
requires = [ "secret.service" ];
|
config.krebs.secret.files."exim.dkim_private_key/${dkim.domain}".service
|
||||||
|
);
|
||||||
|
requires = flip map cfg.dkim (dkim:
|
||||||
|
config.krebs.secret.files."exim.dkim_private_key/${dkim.domain}".service
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
krebs.exim = {
|
krebs.exim = {
|
||||||
|
@ -56,7 +56,7 @@ let
|
|||||||
|
|
||||||
systemd.services = mapAttrs' (name: repo:
|
systemd.services = mapAttrs' (name: repo:
|
||||||
nameValuePair "konsens-${name}" {
|
nameValuePair "konsens-${name}" {
|
||||||
after = [ "network.target" "secret.service" ];
|
after = [ "network.target" ];
|
||||||
path = [ pkgs.git ];
|
path = [ pkgs.git ];
|
||||||
restartIfChanged = false;
|
restartIfChanged = false;
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
|
@ -166,7 +166,13 @@ let
|
|||||||
});
|
});
|
||||||
in nameValuePair "repo-sync-${name}" {
|
in nameValuePair "repo-sync-${name}" {
|
||||||
description = "repo-sync";
|
description = "repo-sync";
|
||||||
after = [ "network.target" "secret.service" ];
|
after = [
|
||||||
|
config.krebs.secret.files.repo-sync-key.service
|
||||||
|
"network.target"
|
||||||
|
];
|
||||||
|
requires = [
|
||||||
|
config.krebs.secret.files.repo-sync-key.service
|
||||||
|
];
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
GIT_SSH_COMMAND = "${pkgs.openssh}/bin/ssh -i ${cfg.stateDir}/ssh.priv";
|
GIT_SSH_COMMAND = "${pkgs.openssh}/bin/ssh -i ${cfg.stateDir}/ssh.priv";
|
||||||
|
@ -219,9 +219,14 @@ let
|
|||||||
iproute = cfg.iproutePackage;
|
iproute = cfg.iproutePackage;
|
||||||
in {
|
in {
|
||||||
description = "Tinc daemon for ${netname}";
|
description = "Tinc daemon for ${netname}";
|
||||||
after = [ "network.target" ];
|
after = [
|
||||||
|
config.krebs.secret.files."${netname}.rsa_key.priv".service
|
||||||
|
"network.target"
|
||||||
|
];
|
||||||
|
requires = [
|
||||||
|
config.krebs.secret.files."${netname}.rsa_key.priv".service
|
||||||
|
];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
requires = [ "secret.service" ];
|
|
||||||
path = [ tinc iproute ];
|
path = [ tinc iproute ];
|
||||||
serviceConfig = rec {
|
serviceConfig = rec {
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
|
@ -9,8 +9,12 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.nix-serve = {
|
systemd.services.nix-serve = {
|
||||||
requires = ["secret.service"];
|
after = [
|
||||||
after = ["secret.service"];
|
config.krebs.secret.files.nix-serve-key.service
|
||||||
|
];
|
||||||
|
requires = [
|
||||||
|
config.krebs.secret.files.nix-serve-key.service
|
||||||
|
];
|
||||||
};
|
};
|
||||||
krebs.secret.files.nix-serve-key = {
|
krebs.secret.files.nix-serve-key = {
|
||||||
path = "/run/secret/nix-serve.key";
|
path = "/run/secret/nix-serve.key";
|
||||||
|
@ -14,8 +14,12 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.mysql = {
|
systemd.services.mysql = {
|
||||||
requires = [ "secret.service" ];
|
after = [
|
||||||
after = [ "secret.service" ];
|
config.krebs.secret.files.mysql_rootPassword.service
|
||||||
|
];
|
||||||
|
requires = [
|
||||||
|
config.krebs.secret.files.mysql_rootPassword.service
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
lass.mysqlBackup = {
|
lass.mysqlBackup = {
|
||||||
|
@ -74,8 +74,15 @@ in {
|
|||||||
|
|
||||||
systemd.services.ejabberd = {
|
systemd.services.ejabberd = {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
requires = [ "secret.service" ];
|
after = [
|
||||||
after = [ "network.target" "secret.service" ];
|
config.krebs.secret.files.ejabberd-certfile.service
|
||||||
|
config.krebs.secret.files.ejabberd-s2s_certfile.service
|
||||||
|
"network.target"
|
||||||
|
];
|
||||||
|
requires = [
|
||||||
|
config.krebs.secret.files.ejabberd-certfile.service
|
||||||
|
config.krebs.secret.files.ejabberd-s2s_certfile.service
|
||||||
|
];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStartPre = "${gen-dhparam} ${cfg.dhfile.path}";
|
ExecStartPre = "${gen-dhparam} ${cfg.dhfile.path}";
|
||||||
ExecStart = "${cfg.pkgs.ejabberdctl}/bin/ejabberdctl foreground";
|
ExecStart = "${cfg.pkgs.ejabberdctl}/bin/ejabberdctl foreground";
|
||||||
|
@ -256,6 +256,10 @@ rec {
|
|||||||
type = str;
|
type = str;
|
||||||
default = "root";
|
default = "root";
|
||||||
};
|
};
|
||||||
|
service = mkOption {
|
||||||
|
type = filename;
|
||||||
|
default = "secret.service";
|
||||||
|
};
|
||||||
source-path = mkOption {
|
source-path = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
default = toString <secrets> + "/${config.name}";
|
default = toString <secrets> + "/${config.name}";
|
||||||
|
@ -9,8 +9,12 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.nix-serve = {
|
systemd.services.nix-serve = {
|
||||||
requires = ["secret.service"];
|
after = [
|
||||||
after = ["secret.service"];
|
config.krebs.secret.files.nix-serve-key.service
|
||||||
|
];
|
||||||
|
requires = [
|
||||||
|
config.krebs.secret.files.nix-serve-key.service
|
||||||
|
];
|
||||||
};
|
};
|
||||||
krebs.secret.files.nix-serve-key = {
|
krebs.secret.files.nix-serve-key = {
|
||||||
path = "/run/secret/nix-serve.key";
|
path = "/run/secret/nix-serve.key";
|
||||||
|
@ -71,8 +71,12 @@ in
|
|||||||
};
|
};
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
systemd.services.netdata = {
|
systemd.services.netdata = {
|
||||||
requires = [ "secret.service" ];
|
after = [
|
||||||
after = [ "secret.service" ];
|
config.krebs.secret.files.netdata-stream.service
|
||||||
|
];
|
||||||
|
requires = [
|
||||||
|
config.krebs.secret.files.netdata-stream.service
|
||||||
|
];
|
||||||
};
|
};
|
||||||
krebs.secret.files.netdata-stream = {
|
krebs.secret.files.netdata-stream = {
|
||||||
path = "/run/secret/netdata-stream.conf";
|
path = "/run/secret/netdata-stream.conf";
|
||||||
|
@ -9,8 +9,12 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.nix-serve = {
|
systemd.services.nix-serve = {
|
||||||
requires = ["secret.service"];
|
after = [
|
||||||
after = ["secret.service"];
|
config.krebs.secret.files.binary-cache-seckey.service
|
||||||
|
];
|
||||||
|
requires = [
|
||||||
|
config.krebs.secret.files.binary-cache-seckey.service
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
krebs.secret.files.binary-cache-seckey = {
|
krebs.secret.files.binary-cache-seckey = {
|
||||||
|
@ -51,8 +51,15 @@ in {
|
|||||||
|
|
||||||
systemd.services.charybdis = {
|
systemd.services.charybdis = {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
requires = [ "secret.service" ];
|
after = [
|
||||||
after = [ "network-online.target" "secret.service" ];
|
config.krebs.secret.files.charybdis-ssl_dh_params.service
|
||||||
|
config.krebs.secret.files.charybdis-ssl_private_key.service
|
||||||
|
"network-online.target"
|
||||||
|
];
|
||||||
|
requires = [
|
||||||
|
config.krebs.secret.files.charybdis-ssl_dh_params.service
|
||||||
|
config.krebs.secret.files.charybdis-ssl_private_key.service
|
||||||
|
];
|
||||||
environment = {
|
environment = {
|
||||||
BANDB_DBPATH = "${cfg.user.home}/ban.db";
|
BANDB_DBPATH = "${cfg.user.home}/ban.db";
|
||||||
};
|
};
|
||||||
|
@ -95,8 +95,15 @@ in {
|
|||||||
|
|
||||||
systemd.services.ejabberd = {
|
systemd.services.ejabberd = {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
requires = [ "secret.service" ];
|
after = [
|
||||||
after = [ "network.target" "secret.service" ];
|
config.krebs.secret.files.ejabberd-certfile.service
|
||||||
|
config.krebs.secret.files.ejabberd-s2s_certfile.service
|
||||||
|
"network.target"
|
||||||
|
];
|
||||||
|
requires = [
|
||||||
|
config.krebs.secret.files.ejabberd-certfile.service
|
||||||
|
config.krebs.secret.files.ejabberd-s2s_certfile.service
|
||||||
|
];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStartPre = "${gen-dhparam} ${cfg.dhfile.path}";
|
ExecStartPre = "${gen-dhparam} ${cfg.dhfile.path}";
|
||||||
ExecStart = "${cfg.pkgs.ejabberd}/bin/ejabberdctl foreground";
|
ExecStart = "${cfg.pkgs.ejabberd}/bin/ejabberdctl foreground";
|
||||||
|
@ -36,8 +36,16 @@ in {
|
|||||||
x0vncserver-pwfile = cfg.pwfile;
|
x0vncserver-pwfile = cfg.pwfile;
|
||||||
};
|
};
|
||||||
systemd.services.x0vncserver = {
|
systemd.services.x0vncserver = {
|
||||||
after = [ "graphical.target" "secret.service" ];
|
after = [
|
||||||
requires = [ "graphical.target" "secret.service" ];
|
config.krebs.secret.files.x0vncserver-pwfile.service
|
||||||
|
"graphical.target"
|
||||||
|
];
|
||||||
|
partOf = [
|
||||||
|
config.krebs.secret.files.x0vncserver-pwfile.service
|
||||||
|
];
|
||||||
|
requires = [
|
||||||
|
"graphical.target"
|
||||||
|
];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${pkgs.tigervnc}/bin/x0vncserver ${toString [
|
ExecStart = "${pkgs.tigervnc}/bin/x0vncserver ${toString [
|
||||||
"-display ${cfg.display}"
|
"-display ${cfg.display}"
|
||||||
|
Loading…
Reference in New Issue
Block a user