Invoiceplane: Difference between revisions
→Invoice templates: Update example template |
|||
(5 intermediate revisions by the same user not shown) | |||
Line 12: | Line 12: | ||
It is recommended to disable the setup wizard after installation is complete. Add following arguments to the settings option: | It is recommended to disable the setup wizard after installation is complete. Add following arguments to the settings option: | ||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
Line 28: | Line 26: | ||
Invoiceplane will render and export invoices as PDF. You can create your own invoice templates or reuse existing ones. The following example fetches an invoice template and makes it available to your running Invoiceplane instance | Invoiceplane will render and export invoices as PDF. You can create your own invoice templates or reuse existing ones. The following example fetches an invoice template and makes it available to your running Invoiceplane instance | ||
{{file| | {{file|||<nowiki> | ||
{ config, pkgs, lib, ... }: | { config, pkgs, lib, ... }: | ||
let | let | ||
template-vtdirektmarketing = pkgs.stdenv.mkDerivation { | invoiceplane-template-vtdirektmarketing = pkgs.stdenv.mkDerivation { | ||
name = "vtdirektmarketing"; | name = "vtdirektmarketing"; | ||
src = pkgs. | src = pkgs.fetchFromGitLab { | ||
domain = "git.project-insanity.org"; | |||
rev = " | owner = "onny"; | ||
hash = "sha256- | repo = "invoiceplane-vtdirektmarketing"; | ||
rev = "a779ea08aaf88d4a4e8afb555a8953f5432f7d49"; | |||
hash = "sha256-H82p46n7OuJA8nzSZWcVRnxfmTrrqaNy+R5qbj0EWtw="; | |||
}; | }; | ||
makeFlags = [ "DESTDIR=$(out)" ]; | makeFlags = [ "DESTDIR=$(out)" ]; | ||
Line 46: | Line 46: | ||
services.invoiceplane.sites."localhost" = { | services.invoiceplane.sites."localhost" = { | ||
enable = true; | enable = true; | ||
invoiceTemplates = [ template-vtdirektmarketing ]; | invoiceTemplates = [ invoiceplane-template-vtdirektmarketing ]; | ||
}; | }; | ||
} | } | ||
</nowiki>}} | </nowiki>|name=|lang=Nix}} | ||
=== Invoice mail delivery === | === Invoice mail delivery === | ||
Line 96: | Line 96: | ||
After upgrading to a new version of Invoiceplane, change following two lines of your Invoiceplane config to re-enable the setup wizard, required for database upgrades. | After upgrading to a new version of Invoiceplane, change following two lines of your Invoiceplane config to re-enable the setup wizard, required for database upgrades. | ||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
Line 107: | Line 105: | ||
Access your Invoiceplane instance again in your browser and rerun the setup. After upgrading the tables you can login as usual. It is now recommended to change both variables in the config file above back to <code>true</code>. | Access your Invoiceplane instance again in your browser and rerun the setup. After upgrading the tables you can login as usual. It is now recommended to change both variables in the config file above back to <code>true</code>. | ||
== Tips and tricks == | |||
=== Invoice template development === | |||
Following <code>flake.nix</code> file helps you spawning a virtual machine running a development environment of Invoiceplane. The local directory <code>/home/user/my_invoiceplane_template</code> containing a modified invoice or quote template will be mounted into the Invoiceplane web app, allowing to change the template and directly render the invoice PDF in the local web server at http://localhost:8080<syntaxhighlight lang="nix"> | |||
{ | |||
description = "Invoiceplane invoice template development shell"; | |||
inputs.nixpkgs.url = "nixpkgs/nixos-24.11"; | |||
outputs = { self, nixpkgs, ... }@inputs: | |||
let | |||
pkgs = nixpkgs.legacyPackages.x86_64-linux; | |||
start = | |||
pkgs.writeShellScriptBin "start" '' | |||
set -e | |||
export QEMU_NET_OPTS="hostfwd=tcp::8080-:80" | |||
${pkgs.nixos-shell}/bin/nixos-shell --flake . | |||
''; | |||
in { | |||
nixosConfigurations.vm = nixpkgs.lib.nixosSystem { | |||
system = "x86_64-linux"; | |||
specialArgs.inputs = inputs; | |||
pkgs = import nixpkgs { | |||
overlays = [ | |||
(self: super: { | |||
invoiceplane = super.invoiceplane.overrideAttrs (oldAttrs: rec { | |||
installPhase = oldAttrs.installPhase + '' | |||
rm -r $out/application/views/invoice_templates/pdf | |||
ln -sf /var/lib/invoiceplane/localhost/pdf $out/application/views/invoice_templates/pdf | |||
''; | |||
}); | |||
}) | |||
]; | |||
}; | |||
modules = [ | |||
({ lib, config, pkgs, ... }: { | |||
services.invoiceplane.sites."localhost" = { | |||
enable = true; | |||
settings.IP_URL = "http://localhost:8080"; | |||
}; | |||
nixos-shell.mounts.extraMounts = { | |||
"/var/lib/invoiceplane/localhost/pdf" = { | |||
target = /home/user/my_invoiceplane_template; | |||
cache = "none"; | |||
}; | |||
}; | |||
system.stateVersion = "24.11"; | |||
services.getty.autologinUser = "root"; | |||
}) | |||
]; | |||
}; | |||
packages = { inherit start; }; | |||
defaultPackage.x86_64-linux = start; | |||
}; | |||
} | |||
</syntaxhighlight>To run the web server simply execute following command in the same directory as the <code>flake.nix</code> file<syntaxhighlight lang="shell"> | |||
nix run | |||
</syntaxhighlight> | |||
== See also == | == See also == |