{ config, lib, pkgs, hydra, ... }: with lib; let cfg = config.modules.services.hydra; in { options.modules.services.hydra = { enable = mkEnableOption "Whether to enable Hydra, a Nix-based continuous build system"; baseURL = mkOption { type = types.str; example = "https://hydra.kanata.network"; description = "The base URL for the Hydra webserver instance"; }; }; config = mkIf cfg.enable { services.hydra = { enable = true; package = hydra.packages.x86_64-linux.hydra; hydraURL = cfg.baseURL; dbi = "dbi:Pg:dbname=hydra;user=hydra;"; useSubstitutes = true; notificationSender = "hydra@kanata.network"; listenHost = "localhost"; port = 4004; }; modules.persistence.directories = [ "/var/lib/hydra" ]; nix.settings.allowed-uris = [ "github:" "https://" "http://" "git+http://" "git+https://" ]; }; }