From e9b02fb0c3ec82008bec23eaa51ca891195314d7 Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Mon, 6 May 2024 18:40:38 +0200 Subject: [PATCH] chore(nix): factor out the Gerrit configuration to the Nix module Signed-off-by: Raito Bezarius --- nix/coordinator.nix | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/nix/coordinator.nix b/nix/coordinator.nix index fe17720..8135495 100644 --- a/nix/coordinator.nix +++ b/nix/coordinator.nix @@ -79,6 +79,34 @@ in }; }; + gerrit = { + domain = lib.mkOption { + type = lib.types.str; + description = "Domain to the Gerrit server"; + example = "gerrit.lix.systems"; + }; + + username = lib.mkOption { + type = lib.types.str; + description = "Username to log in to the Gerrit API"; + example = "buildbot"; + }; + + port = lib.mkOption { + type = lib.types.port; + description = "Port to log in to the Gerrit API"; + example = 2022; + }; + + privateKeyFile = lib.mkOption { + type = lib.types.path; + description = '' + Path to the SSH private key to authenticate against the Gerrit API + ''; + example = "/var/lib/buildbot/master/id_gerrit"; + }; + }; + binaryCache = { enable = lib.mkEnableOption " binary cache upload to a S3 bucket"; profileCredentialsFile = lib.mkOption { @@ -137,10 +165,10 @@ in '' '' GerritNixConfigurator( - "gerrit.lix.systems", - "buildbot", - 2022, - "/var/lib/buildbot/master/id_gerrit", + "${cfg.gerrit.domain}", + "${cfg.gerrit.username}", + "${toString cfg.gerrit.port}", + "${cfg.gerrit.privateKeyFile}", url=${builtins.toJSON config.services.buildbot-master.buildbotUrl}, nix_eval_max_memory_size=${builtins.toJSON cfg.evalMaxMemorySize}, nix_eval_worker_count=${if cfg.evalWorkerCount == null then "None" else builtins.toString cfg.evalWorkerCount},