nixos/modules/drone/server.nix
Jake Hillion 785a17059d
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
drone.server: modularise
2023-12-08 23:42:55 +00:00

44 lines
1.3 KiB
Nix

{ config, pkgs, lib, ... }:
let
cfg = config.custom.drone.server;
in
{
options.custom.drone.server = {
enable = lib.mkEnableOption "drone server";
path = lib.mkOption {
type = lib.types.str;
default = "/var/lib/drone";
};
port = lib.mkOption {
type = lib.types.port;
default = 18733;
};
};
config = lib.mkIf cfg.enable {
age.secrets."drone/gitea_client_secret".file = ../../secrets/drone/gitea_client_secret.age;
age.secrets."drone/rpc_secret".file = ../../secrets/drone/rpc_secret.age;
virtualisation.oci-containers.containers."drone" = {
image = "drone/drone:2.21.0";
volumes = [ "${cfg.path}:/data" ];
ports = [ "${toString cfg.port}:80" ];
environment = {
DRONE_AGENTS_ENABLED = "true";
DRONE_GITEA_SERVER = "https://gitea.hillion.co.uk";
DRONE_GITEA_CLIENT_ID = "687ee331-ad9e-44fd-9e02-7f1c652754bb";
DRONE_SERVER_HOST = "drone.hillion.co.uk";
DRONE_SERVER_PROTO = "https";
DRONE_LOGS_DEBUG = "true";
DRONE_USER_CREATE = "username:JakeHillion,admin:true";
};
environmentFiles = [
config.age.secrets."drone/gitea_client_secret".path
config.age.secrets."drone/rpc_secret".path
];
};
};
}