feat(nix/prog): add hledger to manage finance

This commit is contained in:
Dmitriy Pleshevskiy 2022-05-03 23:35:29 +03:00
parent 94a6ed302f
commit 0fed0e6df0
2 changed files with 50 additions and 0 deletions

View file

@ -13,6 +13,7 @@ in
./progs/nvim.nix ./progs/nvim.nix
./progs/exa.nix ./progs/exa.nix
./progs/zoxide.nix ./progs/zoxide.nix
./progs/hledger.nix
]; ];
targets.genericLinux.enable = true; targets.genericLinux.enable = true;
@ -67,6 +68,9 @@ in
# email manager # email manager
himalaya.enable = true; himalaya.enable = true;
# finance manager
hledger.enable = true;
# editor # editor
nvim = { nvim = {
enable = true; enable = true;

46
nix/progs/hledger.nix Normal file
View file

@ -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;
};
}