From 0fed0e6df04f1477e0e1407f00eecc65589b2267 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Tue, 3 May 2022 23:35:29 +0300 Subject: [PATCH] feat(nix/prog): add hledger to manage finance --- nix/home.nix | 4 ++++ nix/progs/hledger.nix | 46 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 nix/progs/hledger.nix diff --git a/nix/home.nix b/nix/home.nix index 801d907..4e9edb5 100644 --- a/nix/home.nix +++ b/nix/home.nix @@ -13,6 +13,7 @@ in ./progs/nvim.nix ./progs/exa.nix ./progs/zoxide.nix + ./progs/hledger.nix ]; targets.genericLinux.enable = true; @@ -67,6 +68,9 @@ in # email manager himalaya.enable = true; + # finance manager + hledger.enable = true; + # editor nvim = { enable = true; diff --git a/nix/progs/hledger.nix b/nix/progs/hledger.nix new file mode 100644 index 0000000..0fed866 --- /dev/null +++ b/nix/progs/hledger.nix @@ -0,0 +1,46 @@ +{ lib, config, pkgs, ... }: + +with lib; + +let + cfg = config.progs.hledger; + hledgerAliases = { + # TODO: add aliases for business and family accounts + }; +in +{ + options.progs.hledger = { + enable = mkOption { + type = types.bool; + default = false; + description = "Add and configure hledger tool to manage finance"; + }; + }; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ + hledger + hledger-ui + ]; + + home.file = { + "finance/commodities.journal".text = '' + ; Fiat currencies + commodity RUB 1000.00 + commodity $1000.00 + + ; Investment commodities + + ; Cryptocurrencies + + ; Other + + ; Default commodity + D RUB 1000.00 + ''; + }; + + programs.zsh.shellAliases = mkIf config.shell.zsh.enable hledgerAliases; + }; +} +