system/home/progs/hledger.nix

53 lines
905 B
Nix
Raw Normal View History

{ lib, config, pkgs, ... }:
with lib;
let
cfg = config.progs.hledger;
2022-05-15 14:40:05 +03:00
bin = "${pkgs.hledger}/bin/hledger";
sbin = "${bin} --strict";
hledgerAliases = {
2022-05-15 14:40:05 +03:00
hle = bin;
shle = sbin;
};
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
hledger-interest
];
home.file = {
"finance/commodities.journal".text = ''
; Fiat currencies
commodity 1.000,00 RUB
commodity 1.000,00 USD
; Investment commodities
; Cryptocurrencies
; Other
; Default commodity
; D 1.000,00 RUB
'';
};
programs.zsh.shellAliases = mkIf config.shell.zsh.enable hledgerAliases;
};
}