depot/third_party/home-manager/modules/programs/ledger.nix
Default email 2eafb8192e Project import generated by Copybara.
GitOrigin-RevId: 176e455371a8371586e8a3ff0d56ee9f3ca2324e
2023-01-10 02:35:00 -07:00

39 lines
942 B
Nix

{ 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 <filename>$XDG_CONFIG_HOME/ledger/ledgerrc</filename>.
See <link xlink:href="https://www.ledger-cli.org/3.0/doc/ledger3.html#Detailed-Option-Description"/>
for explanation about possible values.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
xdg.configFile."ledger/ledgerrc" =
mkIf (cfg.extraConfig != "") { text = cfg.extraConfig; };
};
}