modules(drone-exec-runner): moar better
This commit is contained in:
parent
fb954f2d77
commit
accadf9f12
1 changed files with 53 additions and 45 deletions
|
@ -2,10 +2,9 @@
|
|||
with lib;
|
||||
with types;
|
||||
let
|
||||
cfg = config.services.drone-exec-runner;
|
||||
in
|
||||
{
|
||||
options.services.drone-exec-runner = {
|
||||
runners = config.services.drone-exec-runner;
|
||||
runnerOpts = {
|
||||
options = {
|
||||
enable = mkEnableOption "Enable an Drone CI/CD Exec Runner";
|
||||
package = mkOption {
|
||||
type = package;
|
||||
|
@ -38,13 +37,21 @@ in
|
|||
git
|
||||
gnutar
|
||||
bash
|
||||
nixUnstable
|
||||
nix
|
||||
gzip
|
||||
];
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services.drone-runner-exec = {
|
||||
};
|
||||
in
|
||||
{
|
||||
options.services.drone-exec-runner = mkOption {
|
||||
type = attrsOf (submodule runnerOpts);
|
||||
default = {};
|
||||
};
|
||||
|
||||
config = mkIf (any (catAttrs "enable" (attrValues runners))) {
|
||||
systemd.services = mapAttrs' (runnerName: cfg: nameValuePair ("drone-exec-runner-${runnerName}") ({
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
confinement.enable = true;
|
||||
|
@ -81,12 +88,13 @@ in
|
|||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
};
|
||||
};
|
||||
}) runners;
|
||||
|
||||
users.users.${cfg.user} = {
|
||||
users.users = mapAttrs' (_: cfg: nameValuePair cfg.user ({
|
||||
isSystemUser = true;
|
||||
group = cfg.group;
|
||||
};
|
||||
users.groups.${cfg.group} = {};
|
||||
inherit (cfg) group;
|
||||
})) runners;
|
||||
|
||||
users.groups = mapAttrs' (_: cfg: nameValuePair cfg.group {}) runners;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue