diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 281fc006..21af0a18 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -158,6 +158,8 @@ Makefile @thiagokokada /modules/programs/lazygit.nix @kalhauge +/modules/programs/ledger.nix @marsam + /modules/programs/less.nix @pamplemousse /tests/modules/programs/less @pamplemousse diff --git a/modules/misc/news.nix b/modules/misc/news.nix index e0a313e7..695e1026 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -726,6 +726,13 @@ in A new module is available: 'programs.pls'. ''; } + + { + time = "2022-10-06T23:06:08+00:00"; + message = '' + A new module is available: 'programs.ledger'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 4f3b3fde..92030b99 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -101,6 +101,7 @@ let ./programs/kitty.nix ./programs/kodi.nix ./programs/lazygit.nix + ./programs/ledger.nix ./programs/less.nix ./programs/lesspipe.nix ./programs/lf.nix diff --git a/modules/programs/ledger.nix b/modules/programs/ledger.nix new file mode 100644 index 00000000..c51ed7d1 --- /dev/null +++ b/modules/programs/ledger.nix @@ -0,0 +1,39 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.ledger; + +in { + meta.maintainers = [ maintainers.marsam ]; + + options.programs.ledger = { + enable = mkEnableOption "ledger, a double-entry accounting system"; + + package = mkPackageOption pkgs "ledger" { }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + example = literalExpression '' + --sort date + --effective + --date-format %Y-%m-%d + ''; + description = '' + Configuration written to $XDG_CONFIG_HOME/ledger/ledgerrc. + See + for explanation about possible values. + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + xdg.configFile."ledger/ledgerrc" = + mkIf (cfg.extraConfig != "") { text = cfg.extraConfig; }; + }; +}