2022-11-19 20:00:54 +01:00
|
|
|
{ config, lib, ... }:
|
2024-02-05 11:46:52 +01:00
|
|
|
with lib;
|
|
|
|
let
|
2022-03-01 22:19:03 +01:00
|
|
|
cfg = config.eboskma.drone;
|
2022-04-27 00:21:19 +02:00
|
|
|
in
|
|
|
|
{
|
2021-12-10 20:11:36 +01:00
|
|
|
options.eboskma.drone = {
|
|
|
|
enable = mkEnableOption "activate drone CI";
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2022-11-01 19:59:28 +01:00
|
|
|
virtualisation.docker = {
|
|
|
|
enable = true;
|
|
|
|
autoPrune = {
|
|
|
|
enable = true;
|
|
|
|
dates = "weekly";
|
|
|
|
};
|
|
|
|
};
|
2022-11-11 11:54:21 +01:00
|
|
|
|
2021-12-10 20:11:36 +01:00
|
|
|
virtualisation.oci-containers.containers = {
|
|
|
|
drone = {
|
|
|
|
autoStart = true;
|
|
|
|
image = "drone/drone:2";
|
2022-04-27 00:21:19 +02:00
|
|
|
ports = [ "8100:80" ];
|
|
|
|
volumes = [ "drone_data:/data" ];
|
2024-02-05 11:46:52 +01:00
|
|
|
environmentFiles = [ config.sops.secrets.drone.path ];
|
2021-12-10 20:11:36 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
drone-runner-docker = {
|
|
|
|
autoStart = true;
|
|
|
|
image = "drone/drone-runner-docker:1";
|
2022-04-27 00:21:19 +02:00
|
|
|
ports = [ "3000:3000" ];
|
2024-02-05 11:46:52 +01:00
|
|
|
volumes = [ "/var/run/docker.sock:/var/run/docker.sock" ];
|
|
|
|
environmentFiles = [ config.sops.secrets.drone-runner.path ];
|
2021-12-10 20:11:36 +01:00
|
|
|
};
|
|
|
|
};
|
2022-11-01 19:59:28 +01:00
|
|
|
|
|
|
|
users.users.${config.eboskma.var.mainUser}.extraGroups = [ "docker" ];
|
2021-12-10 20:11:36 +01:00
|
|
|
};
|
|
|
|
}
|