From 2b540c97f99e33fdc5312674bfbf6fd23e58034b Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Sun, 23 Feb 2025 15:19:04 +0100 Subject: [PATCH] nixos/invoiceplane: Add quoteTemplates option --- .../services/web-apps/invoiceplane.nix | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/nixos/modules/services/web-apps/invoiceplane.nix b/nixos/modules/services/web-apps/invoiceplane.nix index 8904c41beea7..02f8a6673fae 100644 --- a/nixos/modules/services/web-apps/invoiceplane.nix +++ b/nixos/modules/services/web-apps/invoiceplane.nix @@ -93,6 +93,9 @@ let ${concatMapStringsSep "\n" ( template: "cp -r ${template}/. $out/application/views/invoice_templates/pdf/" ) cfg.invoiceTemplates} + ${concatMapStringsSep "\n" ( + template: "cp -r ${template}/. $out/application/views/quote_templates/pdf/" + ) cfg.quoteTemplates} ''; }; @@ -187,6 +190,38 @@ let ''; }; + quoteTemplates = mkOption { + type = types.listOf types.path; + default = [ ]; + description = '' + List of path(s) to respective template(s) which are copied from the 'quote_templates/pdf' directory. + + ::: {.note} + These templates need to be packaged before use, see example. + ::: + ''; + example = literalExpression '' + let + # Let's package an example template + template-vtdirektmarketing = pkgs.stdenv.mkDerivation { + name = "vtdirektmarketing"; + # Download the template from a public repository + src = pkgs.fetchgit { + url = "https://git.project-insanity.org/onny/invoiceplane-vtdirektmarketing.git"; + sha256 = "1hh0q7wzsh8v8x03i82p6qrgbxr4v5fb05xylyrpp975l8axyg2z"; + }; + sourceRoot = "."; + # Installing simply means copying template php file to the output directory + installPhase = "" + mkdir -p $out + cp invoiceplane-vtdirektmarketing/vtdirektmarketing.php $out/ + ""; + }; + # And then pass this package to the template list like this: + in [ template-vtdirektmarketing ] + ''; + }; + poolConfig = mkOption { type = with types;