From 92b1cf8b4ccc16e42b04d518f9d23de42cc97c07 Mon Sep 17 00:00:00 2001 From: Felix Singer Date: Sat, 7 May 2022 07:48:08 +0200 Subject: [PATCH] nixos/redmine: Make optional components configurable Currently, optional components and integrations of Redmine are enforced to install in NixOS. Thus, add the following options allowing the users to enable or disable the components. They are disabled by default. Enabling these options will add their package to the Redmine environment and will configure their specific setting in the Redmine configuration file. * services.redmine.components.subversion * services.redmine.components.mercurial * services.redmine.components.git * services.redmine.components.cvs * services.redmine.components.breezy * services.redmine.components.imagemagick Signed-off-by: Felix Singer --- nixos/modules/services/misc/redmine.nix | 63 ++++++++++++++++++++----- 1 file changed, 51 insertions(+), 12 deletions(-) diff --git a/nixos/modules/services/misc/redmine.nix b/nixos/modules/services/misc/redmine.nix index 45443b5f9f5b..0cf8acbbf79e 100644 --- a/nixos/modules/services/misc/redmine.nix +++ b/nixos/modules/services/misc/redmine.nix @@ -206,6 +206,44 @@ in description = "Create the database and database user locally."; }; }; + + components = { + subversion = mkOption { + type = types.bool; + default = false; + description = "Subversion integration."; + }; + + mercurial = mkOption { + type = types.bool; + default = false; + description = "Mercurial integration."; + }; + + git = mkOption { + type = types.bool; + default = false; + description = "git integration."; + }; + + cvs = mkOption { + type = types.bool; + default = false; + description = "cvs integration."; + }; + + breezy = mkOption { + type = types.bool; + default = false; + description = "bazaar integration."; + }; + + imagemagick = mkOption { + type = types.bool; + default = false; + description = "Allows exporting Gant diagrams as PNG."; + }; + }; }; }; @@ -229,11 +267,11 @@ in services.redmine.settings = { production = { - scm_subversion_command = "${pkgs.subversion}/bin/svn"; - scm_mercurial_command = "${pkgs.mercurial}/bin/hg"; - scm_git_command = "${pkgs.git}/bin/git"; - scm_cvs_command = "${pkgs.cvs}/bin/cvs"; - scm_bazaar_command = "${pkgs.breezy}/bin/bzr"; + scm_subversion_command = if cfg.components.subversion then "${pkgs.subversion}/bin/svn" else ""; + scm_mercurial_command = if cfg.components.mercurial then "${pkgs.mercurial}/bin/hg" else ""; + scm_git_command = if cfg.components.git then "${pkgs.git}/bin/git" else ""; + scm_cvs_command = if cfg.components.cvs then "${pkgs.cvs}/bin/cvs" else ""; + scm_bazaar_command = if cfg.components.breezy then "${pkgs.breezy}/bin/bzr" else ""; }; }; @@ -295,13 +333,14 @@ in environment.REDMINE_LANG = "en"; environment.SCHEMA = "${cfg.stateDir}/cache/schema.db"; path = with pkgs; [ - imagemagick - breezy - cvs - git - mercurial - subversion - ]; + ] + ++ optional cfg.components.subversion subversion + ++ optional cfg.components.mercurial mercurial + ++ optional cfg.components.git git + ++ optional cfg.components.cvs cvs + ++ optional cfg.components.breezy breezy + ++ optional cfg.components.imagemagick imagemagick; + preStart = '' rm -rf "${cfg.stateDir}/plugins/"* rm -rf "${cfg.stateDir}/public/themes/"*