diff --git a/flake.nix b/flake.nix index 2e69ce7..89a3dd6 100644 --- a/flake.nix +++ b/flake.nix @@ -23,6 +23,8 @@ url = "github:serokell/deploy-rs"; inputs.nixpkgs.follows = "nixpkgs"; }; + + buildbot-nix.url = "github:Mic92/buildbot-nix"; }; outputs = inputs: let @@ -49,6 +51,10 @@ }; }; + systems.modules.nixos = [ + inputs.buildbot-nix.nixosModules.buildbot-master + ]; + checks = builtins.mapAttrs (system: deploy-lib: deploy-lib.deployChecks inputs.self.deploy) diff --git a/modules/nixos/auxolotl/services/buildbot/default.nix b/modules/nixos/auxolotl/services/buildbot/default.nix new file mode 100644 index 0000000..5929f94 --- /dev/null +++ b/modules/nixos/auxolotl/services/buildbot/default.nix @@ -0,0 +1,65 @@ +# SPDX-FileCopyrightText: 2024 Auxolotl Infrastructure Contributors +# +# SPDX-License-Identifier: GPL-3.0-only + +{ + lib, + pkgs, + config, + ... +}: let + cfg = config.auxolotl.services.buildbot; +in { + options.auxolotl.services.buildbot = { + enable = lib.mkEnableOption "Matrix chat"; + + domain = lib.mkOption { + type = lib.types.str; + description = "Buildbot domain"; + }; + + admins = lib.mkOption { + type = lib.types.listOf lib.types.str; + description = "List of usernames to give admin permissions to. This allows them to reload the project list."; + default = [ ]; + }; + + gitea = { + url = lib.mkOption { + type = lib.types.str; + description = "URL of the gitea instance to connect to."; + }; + oauthId = lib.mkOption { + type = lib.types.str; + description = "Oauth ID for the login buttons."; + }; + }; + }; + + config = lib.mkIf cfg.enable { + services.buildbot-nix.master = { + enable = true; + + domain = cfg.domain; + admins = cfg.admins; + + authBackend = "gitea"; + + gitea = { + tokenFile = /.; + webhookSecretFile = /.; + + instanceUrl = cfg.giteaUrl; + }; + }; + + services.nginx = { + enable = true; + + virtualHosts."${cfg.domain}" = { + forceSSL = true; + enableACME = true; + }; + }; + }; +}