summary refs log tree commit diff
diff options
context:
space:
mode:
authorFelix Singer <felixsinger@posteo.net>2022-05-15 00:02:45 +0200
committerFelix Singer <felixsinger@posteo.net>2022-05-15 01:47:23 +0200
commit562bc5c2a9c4479b11e454d2ac75fccd13e043b9 (patch)
treecb9bfdd3a7d28a79e27906938ac566748877e04e
parent66ef66fc6215fa22f1f216d00ae258db93fe9441 (diff)
downloadnixpkgs-562bc5c2a9c4479b11e454d2ac75fccd13e043b9.tar
nixpkgs-562bc5c2a9c4479b11e454d2ac75fccd13e043b9.tar.gz
nixpkgs-562bc5c2a9c4479b11e454d2ac75fccd13e043b9.tar.bz2
nixpkgs-562bc5c2a9c4479b11e454d2ac75fccd13e043b9.tar.lz
nixpkgs-562bc5c2a9c4479b11e454d2ac75fccd13e043b9.tar.xz
nixpkgs-562bc5c2a9c4479b11e454d2ac75fccd13e043b9.tar.zst
nixpkgs-562bc5c2a9c4479b11e454d2ac75fccd13e043b9.zip
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 <felixsinger@posteo.net>
-rw-r--r--nixos/modules/services/misc/redmine.nix11
1 files changed, 11 insertions, 0 deletions
diff --git a/nixos/modules/services/misc/redmine.nix b/nixos/modules/services/misc/redmine.nix
index 3c9391f4ee9..68a4b03991e 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}";
       };
     };