From 1ee1835a3ee303bb694dbe06b4e85b1dc0a03b91 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Mon, 8 Mar 2021 04:20:00 +0000 Subject: [PATCH] lsd: add support for config file lsd 0.19.0 added support for a configuration file --- modules/programs/lsd.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/modules/programs/lsd.nix b/modules/programs/lsd.nix index ab1880ff8..99a76dcb0 100644 --- a/modules/programs/lsd.nix +++ b/modules/programs/lsd.nix @@ -6,6 +6,8 @@ let cfg = config.programs.lsd; + yamlFormat = pkgs.formats.yaml { }; + aliases = { ls = "${pkgs.lsd}/bin/lsd"; ll = "ls -l"; @@ -27,6 +29,21 @@ in { Whether to enable recommended lsd aliases. ''; }; + + settings = mkOption { + type = yamlFormat.type; + default = { }; + example = { + date = "relative"; + ignore-globs = [ ".git" ".hg" ]; + }; + description = '' + Configuration written to + ~/.config/lsd/config.yaml. See + + for supported values. + ''; + }; }; config = mkIf cfg.enable { @@ -37,5 +54,9 @@ in { programs.zsh.shellAliases = mkIf cfg.enableAliases aliases; programs.fish.shellAliases = mkIf cfg.enableAliases aliases; + + xdg.configFile."lsd/config.yaml" = mkIf (cfg.settings != { }) { + source = yamlFormat.generate "lsd-config" cfg.settings; + }; }; }