From f56dcc7c42f03f395e9892ed4d983409ad77f539 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 28 Mar 2025 17:26:50 -0400 Subject: [PATCH] Start a hydra role. --- nix/configuration/configuration.nix | 1 + nix/configuration/hosts/hydra/default.nix | 1 + nix/configuration/roles/hydra/default.nix | 50 +++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 nix/configuration/roles/hydra/default.nix diff --git a/nix/configuration/configuration.nix b/nix/configuration/configuration.nix index 3903d78..01a4f30 100644 --- a/nix/configuration/configuration.nix +++ b/nix/configuration/configuration.nix @@ -70,6 +70,7 @@ ./roles/gcloud ./roles/steam_run_free ./roles/pcsx2 + ./roles/hydra ]; nix.settings.experimental-features = [ diff --git a/nix/configuration/hosts/hydra/default.nix b/nix/configuration/hosts/hydra/default.nix index 389dc33..2e21349 100644 --- a/nix/configuration/hosts/hydra/default.nix +++ b/nix/configuration/hosts/hydra/default.nix @@ -43,6 +43,7 @@ me.emacs_flavor = "plainmacs"; me.graphical = false; + me.hydra.enable = false; me.vm_disk.enable = true; me.wireguard.activated = [ ]; me.wireguard.deactivated = [ ]; diff --git a/nix/configuration/roles/hydra/default.nix b/nix/configuration/roles/hydra/default.nix new file mode 100644 index 0000000..0017e80 --- /dev/null +++ b/nix/configuration/roles/hydra/default.nix @@ -0,0 +1,50 @@ +{ + config, + lib, + pkgs, + ... +}: + +{ + imports = [ ]; + + options.me = { + hydra.enable = lib.mkOption { + type = lib.types.bool; + default = false; + example = true; + description = "Whether we want to install hydra."; + }; + }; + + config = lib.mkIf config.me.hydra.enable ( + lib.mkMerge [ + { + services.hydra = { + enable = true; + hydraURL = "http://localhost:3000"; # externally visible URL + notificationSender = "hydra@localhost"; # e-mail of Hydra service + # a standalone Hydra will require you to unset the buildMachinesFiles list to avoid using a nonexistant /etc/nix/machines + buildMachinesFiles = [ ]; + # you will probably also want, otherwise *everything* will be built from scratch + useSubstitutes = true; + }; + + # nix.buildMachines = [ + # { + # hostName = "localhost"; + # protocol = null; + # system = "x86_64-linux"; + # supportedFeatures = [ + # "kvm" + # "nixos-test" + # "big-parallel" + # "benchmark" + # ]; + # maxJobs = 8; + # } + # ]; + } + ] + ); +}