loptland: modularize config a little by pulling out modules for gitea-runner and hydra

This commit is contained in:
Christoph Hollizeck 2025-05-05 22:59:04 +02:00
parent 71e8eab3dc
commit 6b31252058
Signed by: Daholli
GPG key ID: 249300664F2AF2C7
3 changed files with 230 additions and 54 deletions

View file

@ -0,0 +1,37 @@
{
lib,
config,
namespace,
...
}:
let
cfg = config.${namespace}.services.hydra;
inherit (lib) mkIf mkOption mkEnableOption;
in
{
options.${namespace}.services.hydra = {
enable = mkEnableOption "Enable Hydra CI";
httpPort = mkOption {
type = lib.types.int;
default = 2000;
description = "The path to host the http server on, relevant for nginx forwarding";
};
enableCache = mkEnableOption "Enable cache using nix-server";
};
config = mkIf cfg.enable {
services.nix-serve = mkIf cfg.enableCache {
enable = true;
secretKeyFile = "/var/cache-priv-key.pem";
};
services.hydra = {
enable = true;
hydraURL = "http://localhost:${toString cfg.httpPort}";
port = cfg.httpPort;
notificationSender = "hydra@localhost";
useSubstitutes = true;
};
};
}