{ lib, config, pkgs, ... }:

let
  bin = "${pkgs.hledger}/bin/hledger";
  sbin = "${bin} --strict";

  hledgerAliases = {
    hle = bin;
    shle = sbin;
  };
in
{
  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 = lib.mkIf config.programs.zsh.enable hledgerAliases;
}
