From 3be58b2afc2369c777f987359c0843e219e78590 Mon Sep 17 00:00:00 2001 From: Felix Singer Date: Sat, 14 May 2022 22:48:52 +0200 Subject: [PATCH 1/5] nixos/redmine: Drop darcs integration darcs support was dropped with Redmine 4.0.0. Thus, drop the darcs integration. For more information, see https://www.redmine.org/issues/26391. Signed-off-by: Felix Singer --- nixos/modules/services/misc/redmine.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/nixos/modules/services/misc/redmine.nix b/nixos/modules/services/misc/redmine.nix index 696b8d1a25d9..45443b5f9f5b 100644 --- a/nixos/modules/services/misc/redmine.nix +++ b/nixos/modules/services/misc/redmine.nix @@ -234,7 +234,6 @@ in scm_git_command = "${pkgs.git}/bin/git"; scm_cvs_command = "${pkgs.cvs}/bin/cvs"; scm_bazaar_command = "${pkgs.breezy}/bin/bzr"; - scm_darcs_command = "${pkgs.darcs}/bin/darcs"; }; }; @@ -299,7 +298,6 @@ in imagemagick breezy cvs - darcs git mercurial subversion From 92b1cf8b4ccc16e42b04d518f9d23de42cc97c07 Mon Sep 17 00:00:00 2001 From: Felix Singer Date: Sat, 7 May 2022 07:48:08 +0200 Subject: [PATCH 2/5] 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/"* From 4d23eae938b33fd9cf5ad046d18fb0266b3ca8de Mon Sep 17 00:00:00 2001 From: Felix Singer Date: Wed, 11 May 2022 00:09:09 +0200 Subject: [PATCH 3/5] nixos/redmine: Add PDF export support for gant Ghostscript is needed to export Gant diagrams as PDF. Thus, add the option `services.redmine.components.ghostscript` allowing to enable or disable the component. The component is disabled by default. Enabling the option will add Ghostscript to the Redmine environment and configure the setting `gs_command` in the Redmine configuration file. Signed-off-by: Felix Singer --- nixos/modules/services/misc/redmine.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/misc/redmine.nix b/nixos/modules/services/misc/redmine.nix index 0cf8acbbf79e..0dcc50978437 100644 --- a/nixos/modules/services/misc/redmine.nix +++ b/nixos/modules/services/misc/redmine.nix @@ -243,6 +243,12 @@ in default = false; description = "Allows exporting Gant diagrams as PNG."; }; + + ghostscript = mkOption { + type = types.bool; + default = false; + description = "Allows exporting Gant diagrams as PDF."; + }; }; }; }; @@ -272,6 +278,7 @@ in 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 ""; + gs_command = if cfg.components.ghostscript then "${pkgs.ghostscript}/bin/gs" else ""; }; }; @@ -339,7 +346,8 @@ in ++ optional cfg.components.git git ++ optional cfg.components.cvs cvs ++ optional cfg.components.breezy breezy - ++ optional cfg.components.imagemagick imagemagick; + ++ optional cfg.components.imagemagick imagemagick + ++ optional cfg.components.ghostscript ghostscript; preStart = '' rm -rf "${cfg.stateDir}/plugins/"* From 66ef66fc6215fa22f1f216d00ae258db93fe9441 Mon Sep 17 00:00:00 2001 From: Felix Singer Date: Wed, 11 May 2022 01:03:48 +0200 Subject: [PATCH 4/5] nixos/redmine: Configure imagemagick_convert_command For completeness, configure the setting `imagemagick_convert_command` in the Redmine configuration file. Signed-off-by: Felix Singer --- nixos/modules/services/misc/redmine.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/modules/services/misc/redmine.nix b/nixos/modules/services/misc/redmine.nix index 0dcc50978437..3c9391f4ee94 100644 --- a/nixos/modules/services/misc/redmine.nix +++ b/nixos/modules/services/misc/redmine.nix @@ -278,6 +278,7 @@ in 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 ""; + imagemagick_convert_command = if cfg.components.imagemagick then "${pkgs.imagemagick}/bin/convert" else ""; gs_command = if cfg.components.ghostscript then "${pkgs.ghostscript}/bin/gs" else ""; }; }; From 562bc5c2a9c4479b11e454d2ac75fccd13e043b9 Mon Sep 17 00:00:00 2001 From: Felix Singer Date: Sun, 15 May 2022 00:02:45 +0200 Subject: [PATCH 5/5] nixos/redmine: Fix PNG generation of Gant diagrams The Ruby gem `minimagick` is used to export Gant diagrams as PNG. However, minimagick can't find a font and Redmine throws an error. The setting `minimagick_font_path` allows configuring a path to a font file in the Redmine configuration. Thus, add the option `services.redmine.components.minimagick_font_path` allowing to do that. Also, add an assertion to check if `services.redmine.components.minimagick_font_path` is set when imagemagick is enabled. Signed-off-by: Felix Singer --- nixos/modules/services/misc/redmine.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nixos/modules/services/misc/redmine.nix b/nixos/modules/services/misc/redmine.nix index 3c9391f4ee94..68a4b03991ed 100644 --- a/nixos/modules/services/misc/redmine.nix +++ b/nixos/modules/services/misc/redmine.nix @@ -249,6 +249,13 @@ in default = false; description = "Allows exporting Gant diagrams as PDF."; }; + + minimagick_font_path = mkOption { + type = types.str; + default = ""; + description = ""; + example = "/run/current-system/sw/share/X11/fonts/LiberationSans-Regular.ttf"; + }; }; }; }; @@ -269,6 +276,9 @@ in { assertion = cfg.database.createLocally -> cfg.database.host == "localhost"; message = "services.redmine.database.host must be set to localhost if services.redmine.database.createLocally is set to true"; } + { assertion = cfg.components.imagemagick -> cfg.components.minimagick_font_path != ""; + message = "services.redmine.components.minimagick_font_path must be configured with a path to a font file if services.redmine.components.imagemagick is set to true."; + } ]; services.redmine.settings = { @@ -280,6 +290,7 @@ in scm_bazaar_command = if cfg.components.breezy then "${pkgs.breezy}/bin/bzr" else ""; imagemagick_convert_command = if cfg.components.imagemagick then "${pkgs.imagemagick}/bin/convert" else ""; gs_command = if cfg.components.ghostscript then "${pkgs.ghostscript}/bin/gs" else ""; + minimagick_font_path = "${cfg.components.minimagick_font_path}"; }; };