diff options
| author | seth <[email protected]> | 2023-10-30 04:22:32 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2023-10-30 09:46:15 +0000 |
| commit | 10b0df38b4286237b56ff9177f8d4c5676bfb5c1 (patch) | |
| tree | ab298c74339bf9bc41571fa88746ecd9c522fbdf /modules/nixos/services/hercules.nix | |
| parent | 4c2c60a4f2b14c1e6ffaffe5e301dc31ac4fed0f (diff) | |
tree-wide: refactor
i went overboard on modules. this is much comfier
Diffstat (limited to 'modules/nixos/services/hercules.nix')
| -rw-r--r-- | modules/nixos/services/hercules.nix | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/modules/nixos/services/hercules.nix b/modules/nixos/services/hercules.nix new file mode 100644 index 0000000..fc3c92d --- /dev/null +++ b/modules/nixos/services/hercules.nix @@ -0,0 +1,55 @@ +{ + config, + lib, + unstable, + ... +}: let + cfg = config.server.services.hercules-ci; + inherit (lib) mkEnableOption mkIf; + + baseDir = ../../../secrets/systems/${config.networking.hostName}; + hercArgs = { + mode = "400"; + owner = "hercules-ci-agent"; + group = "hercules-ci-agent"; + }; +in { + options.server.services.hercules-ci = { + enable = mkEnableOption "enable hercules-ci"; + secrets.enable = mkEnableOption "manage secrets for hercules-ci"; + }; + + config = mkIf cfg.enable { + age.secrets = mkIf cfg.secrets.enable { + binaryCache = + { + file = "${baseDir}/binaryCache.age"; + } + // hercArgs; + + clusterToken = + { + file = "${baseDir}/clusterToken.age"; + } + // hercArgs; + + secretsJson = + { + file = "${baseDir}/secretsJson.age"; + } + // hercArgs; + }; + + services = { + hercules-ci-agent = { + enable = true; + package = unstable.hercules-ci-agent; + settings = { + binaryCachesPath = config.age.secrets.binaryCache.path; + clusterJoinTokenPath = config.age.secrets.clusterToken.path; + secretsJsonPath = config.age.secrets.secretsJson.path; + }; + }; + }; + }; +} |
