k 3 retiolum: explicitly build users, secrets and services
This commit is contained in:
parent
24db6439c4
commit
d35fc9f6d2
@ -13,6 +13,9 @@ let
|
||||
'';
|
||||
type = with types; attrsOf (submodule (tinc: {
|
||||
options = {
|
||||
|
||||
enable = mkEnableOption "krebs.tinc.${tinc.config._module.args.name}" // { default = true; };
|
||||
|
||||
host = mkOption {
|
||||
type = types.host;
|
||||
default = config.krebs.build.host;
|
||||
@ -121,7 +124,17 @@ let
|
||||
};
|
||||
}));
|
||||
};
|
||||
imp = lib.mkMerge ( lib.mapAttrsToList (netname: cfg:
|
||||
imp = {
|
||||
# TODO environment.systemPackages = [ tinc iproute ]; AND avoid conflicts
|
||||
krebs.secret.files = lib.mapAttrs' (netname: cfg:
|
||||
nameValuePair "${netname}.rsa_key.priv" cfg.privkey ) config.krebs.tinc;
|
||||
users.users = lib.mapAttrs' (netname: cfg:
|
||||
nameValuePair "${netname}" {
|
||||
inherit (cfg.user) home name uid;
|
||||
createHome = true;
|
||||
} ) config.krebs.tinc;
|
||||
|
||||
systemd.services = lib.mapAttrs (netname: cfg:
|
||||
let
|
||||
net = cfg.host.nets.${netname};
|
||||
|
||||
@ -153,11 +166,6 @@ let
|
||||
'';
|
||||
});
|
||||
in {
|
||||
krebs.secret.files."${netname}.rsa_key.priv" = cfg.privkey;
|
||||
|
||||
environment.systemPackages = [ tinc iproute ];
|
||||
|
||||
systemd.services.${netname} = {
|
||||
description = "Tinc daemon for ${netname}";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
@ -168,11 +176,6 @@ let
|
||||
ExecStart = "${tinc}/sbin/tincd -c ${confDir} -d 0 -U ${cfg.user.name} -D --pidfile=/var/run/tinc.${SyslogIdentifier}.pid";
|
||||
SyslogIdentifier = netname;
|
||||
};
|
||||
} ) config.krebs.tinc;
|
||||
};
|
||||
|
||||
users.users.${cfg.user.name} = {
|
||||
inherit (cfg.user) home name uid;
|
||||
createHome = true;
|
||||
};
|
||||
}) {} ); # TODO <<<< replace with the "config.krebs.tinc" and avoid infinite recursion
|
||||
in out
|
||||
|
Loading…
Reference in New Issue
Block a user