mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-28 01:43:15 +00:00
nixos/gerrit: allow configuring replication declaratively (#91200)
This commit is contained in:
parent
a4de542abe
commit
c27fc6a5e5
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user