about summary refs log tree commit diff
path: root/modules/services
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2024-02-10 07:16:59 +0900
committersefidel <contact@sefidel.net>2024-02-10 07:24:11 +0900
commit4f9c169b34f69c5cda866a4605d05c4bb09196ae (patch)
treee7d3f8d78c867e6b980c3e121a00a53350df227d /modules/services
parent612e5150fbe3419d5c556c9cbe974ba7541e5f32 (diff)
downloadnixrc-4f9c169b34f69c5cda866a4605d05c4bb09196ae.tar.gz
nixrc-4f9c169b34f69c5cda866a4605d05c4bb09196ae.zip
feat(modules): add hydra
Diffstat (limited to 'modules/services')
-rw-r--r--modules/services/hydra.nix38
1 files changed, 38 insertions, 0 deletions
diff --git a/modules/services/hydra.nix b/modules/services/hydra.nix
new file mode 100644
index 0000000..65f602c
--- /dev/null
+++ b/modules/services/hydra.nix
@@ -0,0 +1,38 @@
+{ 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.kusanari.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@kusanari.network";
+
+      listenHost = "localhost";
+      port = 4004;
+    };
+
+    modules.persistence.directories = [
+      "/var/lib/hydra"
+    ];
+
+    nix.settings.allowed-uris = [ "github:" "https://" "http://" ];
+  };
+}