lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

nixos/paisa: init

+198 -13
+6
nixos/doc/manual/redirects.json
··· 587 587 "module-services-suwayomi-server-extra-config": [ 588 588 "index.html#module-services-suwayomi-server-extra-config" 589 589 ], 590 + "module-services-paisa": [ 591 + "index.html#module-services-paisa" 592 + ], 593 + "module-services-paisa-usage": [ 594 + "index.html#module-services-paisa-usage" 595 + ], 590 596 "module-services-plausible": [ 591 597 "index.html#module-services-plausible" 592 598 ],
+2
nixos/doc/manual/release-notes/rl-2511.section.md
··· 62 62 63 63 - [SuiteNumérique Meet](https://github.com/suitenumerique/meet) is an open source alternative to Google Meet and Zoom powered by LiveKit: HD video calls, screen sharing, and chat features. Built with Django and React. Available as [services.lasuite-meet](#opt-services.lasuite-meet.enable). 64 64 65 + - [paisa](https://github.com/ananthakumaran/paisa), a personal finance tracker and dashboard. Available as [services.paisa](#opt-services.paisa.enable). 66 + 65 67 ## Backward Incompatibilities {#sec-release-25.11-incompatibilities} 66 68 67 69 <!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
+1
nixos/modules/module-list.nix
··· 881 881 ./services/misc/osrm.nix 882 882 ./services/misc/owncast.nix 883 883 ./services/misc/packagekit.nix 884 + ./services/misc/paisa.nix 884 885 ./services/misc/paperless.nix 885 886 ./services/misc/parsoid.nix 886 887 ./services/misc/persistent-evdev.nix
+32
nixos/modules/services/misc/paisa.md
··· 1 + # Paisa {#module-services-paisa} 2 + 3 + *Source:* {file}`modules/services/misc/paisa.nix` 4 + 5 + *Upstream documentation:* <https://paisa.fyi/> 6 + 7 + [Paisa](https://github.com/ananthakumaran/paisa) is a personal finance manager 8 + built on top of the ledger plain-text-accounting tool. 9 + 10 + ## Usage {#module-services-paisa-usage} 11 + 12 + Paisa needs to have one of the following cli tools availabe in the PATH at 13 + runtime: 14 + 15 + - ledger 16 + - hledger 17 + - beancount 18 + 19 + All of these are available from nixpkgs. Currently, it is not possible to 20 + configure this in the module, but you can e.g. use systemd to give the unit 21 + access to the command at runtime. 22 + 23 + ```nix 24 + systemd.services.paisa.path = [ pkgs.hledger ]; 25 + ``` 26 + 27 + ::: {.note} 28 + Paisa needs to be configured to use the correct cli tool. This is possible in 29 + the web interface (make sure to enable [](#opt-services.paisa.mutableSettings) 30 + if you want to persist these settings between service restarts), or in 31 + [](#opt-services.paisa.settings). 32 + :::
+145
nixos/modules/services/misc/paisa.nix
··· 1 + { 2 + config, 3 + lib, 4 + pkgs, 5 + ... 6 + }: 7 + let 8 + cfg = config.services.paisa; 9 + settingsFormat = pkgs.formats.yaml { }; 10 + 11 + args = lib.concatStringsSep " " [ 12 + "--config /var/lib/paisa/paisa.yaml" 13 + ]; 14 + 15 + settings = 16 + if (cfg.settings != null) then 17 + builtins.removeAttrs 18 + ( 19 + cfg.settings 20 + // { 21 + journal_path = cfg.settings.dataDir + cfg.settings.journalFile; 22 + db_path = cfg.settings.dataDir + cfg.settings.dbFile; 23 + } 24 + ) 25 + [ 26 + "dataDir" 27 + "journalFile" 28 + "dbFile" 29 + ] 30 + else 31 + null; 32 + 33 + configFile = (settingsFormat.generate "paisa.yaml" settings).overrideAttrs (_: { 34 + checkPhase = ""; 35 + }); 36 + in 37 + { 38 + options.services.paisa = with lib.types; { 39 + enable = lib.mkEnableOption "Paisa personal finance manager"; 40 + 41 + package = lib.mkPackageOption pkgs "paisa" { }; 42 + 43 + openFirewall = lib.mkOption { 44 + default = false; 45 + type = bool; 46 + description = "Open ports in the firewall for the Paisa web server."; 47 + }; 48 + 49 + mutableSettings = lib.mkOption { 50 + default = true; 51 + type = bool; 52 + description = '' 53 + Allow changes made on the web interface to persist between service 54 + restarts. 55 + ''; 56 + }; 57 + 58 + host = lib.mkOption { 59 + type = str; 60 + default = "0.0.0.0"; 61 + description = "Host bind IP address."; 62 + }; 63 + 64 + port = lib.mkOption { 65 + type = port; 66 + default = 7500; 67 + description = "Port to serve Paisa on."; 68 + }; 69 + 70 + settings = lib.mkOption { 71 + default = null; 72 + type = nullOr (submodule { 73 + freeformType = settingsFormat.type; 74 + options = { 75 + dataDir = lib.mkOption { 76 + type = lib.types.str; 77 + default = "/var/lib/paisa/"; 78 + description = "Path to paisa data directory."; 79 + }; 80 + 81 + journalFile = lib.mkOption { 82 + type = lib.types.str; 83 + default = "main.ledger"; 84 + description = "Filename of the main journal / ledger file."; 85 + }; 86 + 87 + dbFile = lib.mkOption { 88 + type = lib.types.str; 89 + default = "paisa.sqlite3"; 90 + description = "Filename of the Paisa database."; 91 + }; 92 + 93 + }; 94 + }); 95 + description = '' 96 + Paisa configuration. Please refer to 97 + <https://paisa.fyi/reference/config/> for details. 98 + 99 + On start and if `mutableSettings` is `true`, these options are merged 100 + into the configuration file on start, taking precedence over 101 + configuration changes made on the web interface. 102 + ''; 103 + }; 104 + }; 105 + config = lib.mkIf cfg.enable { 106 + assertions = [ ]; 107 + 108 + systemd.services.paisa = { 109 + description = "Paisa: Web Application"; 110 + after = [ "network.target" ]; 111 + wantedBy = [ "multi-user.target" ]; 112 + unitConfig = { 113 + StartLimitIntervalSec = 5; 114 + StartLimitBurst = 10; 115 + }; 116 + 117 + preStart = lib.optionalString (settings != null) '' 118 + if [ -e "$STATE_DIRECTORY/paisa.yaml" ] && [ "${toString cfg.mutableSettings}" = "1" ]; then 119 + # do not write directly to the config file 120 + ${lib.getExe pkgs.yaml-merge} "$STATE_DIRECTORY/paisa.yaml" "${configFile}" > "$STATE_DIRECTORY/paisa.yaml.tmp" 121 + mv "$STATE_DIRECTORY/paisa.yaml.tmp" "$STATE_DIRECTORY/paisa.yaml" 122 + else 123 + cp --force "${configFile}" "$STATE_DIRECTORY/paisa.yaml" 124 + chmod 600 "$STATE_DIRECTORY/paisa.yaml" 125 + fi 126 + ''; 127 + 128 + serviceConfig = { 129 + DynamicUser = true; 130 + ExecStart = "${lib.getExe cfg.package} serve ${args}"; 131 + AmbientCapabilities = [ "CAP_NET_BIND_SERVICE" ]; 132 + Restart = "always"; 133 + RestartSec = 5; 134 + RuntimeDirectory = "paisa"; 135 + StateDirectory = "paisa"; 136 + }; 137 + }; 138 + networking.firewall.allowedTCPPorts = lib.mkIf cfg.openFirewall [ cfg.port ]; 139 + }; 140 + 141 + meta = { 142 + maintainers = with lib.maintainers; [ skowalak ]; 143 + doc = ./paisa.md; 144 + }; 145 + }
+12 -9
nixos/tests/paisa.nix
··· 1 1 { ... }: 2 2 { 3 3 name = "paisa"; 4 - nodes.machine = 5 - { pkgs, lib, ... }: 4 + nodes.serviceEmptyConf = 5 + { ... }: 6 6 { 7 - systemd.services.paisa = { 8 - description = "Paisa"; 9 - wantedBy = [ "multi-user.target" ]; 10 - serviceConfig.ExecStart = "${lib.getExe pkgs.paisa} serve"; 7 + services.paisa = { 8 + enable = true; 9 + 10 + settings = { }; 11 11 }; 12 12 }; 13 + 13 14 testScript = '' 14 15 start_all() 15 16 16 17 machine.systemctl("start network-online.target") 17 18 machine.wait_for_unit("network-online.target") 18 - machine.wait_for_unit("paisa.service") 19 - machine.wait_for_open_port(7500) 20 19 21 - machine.succeed("curl --location --fail http://localhost:7500") 20 + with subtest("empty/default config test"): 21 + serviceEmptyConf.wait_for_unit("paisa.service") 22 + serviceEmptyConf.wait_for_open_port(7500) 23 + 24 + serviceEmptyConf.succeed("curl --location --fail http://localhost:7500") 22 25 ''; 23 26 }
-4
pkgs/by-name/pa/paisa/package.nix
··· 79 79 ]; 80 80 versionCheckProgramArg = "version"; 81 81 82 - passthru.tests = { 83 - inherit (nixosTests) paisa; 84 - }; 85 - 86 82 preBuild = '' 87 83 cp -r ${finalAttrs.frontend}/web/static ./web 88 84 '';