lsd: add support for config file

lsd 0.19.0 added support for a configuration file
This commit is contained in:
Mario Rodas 2021-03-08 04:20:00 +00:00 committed by Robert Helgesson
parent 42bb553544
commit 1ee1835a3e
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -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
<filename>~/.config/lsd/config.yaml</filename>. See
<link xlink:href="https://github.com/Peltoche/lsd#config-file-content"/>
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;
};
};
}