diff options
author | edef <edef@edef.eu> | 2020-06-21 08:54:14 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-21 08:54:14 +0000 |
commit | c27fc6a5e57e53687881d58c443c29f22f92bc73 (patch) | |
tree | c7c6c61cac914605891e0337e334d95b9d0b63d2 /nixos/modules/services/web-apps/gerrit.nix | |
parent | a4de542abea148a147134bd87bce74ba9902831f (diff) | |
download | nixlib-c27fc6a5e57e53687881d58c443c29f22f92bc73.tar nixlib-c27fc6a5e57e53687881d58c443c29f22f92bc73.tar.gz nixlib-c27fc6a5e57e53687881d58c443c29f22f92bc73.tar.bz2 nixlib-c27fc6a5e57e53687881d58c443c29f22f92bc73.tar.lz nixlib-c27fc6a5e57e53687881d58c443c29f22f92bc73.tar.xz nixlib-c27fc6a5e57e53687881d58c443c29f22f92bc73.tar.zst nixlib-c27fc6a5e57e53687881d58c443c29f22f92bc73.zip |
nixos/gerrit: allow configuring replication declaratively (#91200)
Diffstat (limited to 'nixos/modules/services/web-apps/gerrit.nix')
-rw-r--r-- | nixos/modules/services/web-apps/gerrit.nix | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/nixos/modules/services/web-apps/gerrit.nix b/nixos/modules/services/web-apps/gerrit.nix index b184c0754d45..657b1a4fc5ba 100644 --- a/nixos/modules/services/web-apps/gerrit.nix +++ b/nixos/modules/services/web-apps/gerrit.nix @@ -17,6 +17,10 @@ let lib.generators.toGitINI cfg.settings ); + replicationConfig = pkgs.writeText "replication.conf" ( + lib.generators.toGitINI cfg.replicationSettings + ); + # Wrap the gerrit java with all the java options so it can be called # like a normal CLI app gerrit-cli = pkgs.writeShellScriptBin "gerrit" '' @@ -106,6 +110,15 @@ in ''; }; + replicationSettings = mkOption { + type = gitIniType; + default = {}; + description = '' + Replication configuration. This will be generated to the + <literal>etc/replication.config</literal> file. + ''; + }; + plugins = mkOption { type = types.listOf types.package; default = []; @@ -138,6 +151,13 @@ in config = mkIf cfg.enable { + assertions = [ + { + assertion = cfg.replicationSettings != {} -> elem "replication" cfg.builtinPlugins; + message = "Gerrit replicationSettings require enabling the replication plugin"; + } + ]; + services.gerrit.settings = { cache.directory = "/var/cache/gerrit"; container.heapLimit = cfg.jvmHeapLimit; @@ -194,6 +214,7 @@ in # copy the config, keep it mutable because Gerrit ln -sfv ${gerritConfig} etc/gerrit.config + ln -sfv ${replicationConfig} etc/replication.config # install the plugins rm -rf plugins |