fork/home-manager
git clone https://git.julia.blue/fork/home-manager
835465e8
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6 7cfg = config . programs . lsd ; 8 9yamlFormat = pkgs . formats . yaml { }; 10 11aliases = { 12ls = " ${ pkgs . lsd } /bin/lsd" ; 13ll = " ${ pkgs . lsd } /bin/lsd -l" ; 14la = " ${ pkgs . lsd } /bin/lsd -A" ; 15lt = " ${ pkgs . lsd } /bin/lsd --tree" ; 16lla = " ${ pkgs . lsd } /bin/lsd -lA" ; 17llt = " ${ pkgs . lsd } /bin/lsd -l --tree" ; 18}; 19 20in { 21meta . maintainers = [ ]; 22 23options . programs . lsd = { 24enable = mkEnableOption "lsd" ; 25 26enableAliases = mkOption { 27default = false ; 28type = types . bool ; 29description = '' 30Whether to enable recommended lsd aliases. 31'' ; 32}; 33 34settings = mkOption { 35type = yamlFormat . type ; 36default = { }; 37example = { 38date = "relative" ; 39ignore-globs = [ ".git" ".hg" ]; 40}; 41description = '' 42Configuration written to 43{file}`$XDG_CONFIG_HOME/lsd/config.yaml`. See 44<https://github.com/Peltoche/lsd#config-file-content> 45for supported values. 46'' ; 47}; 48 49colors = mkOption { 50type = yamlFormat . type ; 51default = { }; 52example = { 53size = { 54none = "grey" ; 55small = "yellow" ; 56large = "dark_yellow" ; 57}; 58}; 59description = '' 60Configuration written to {file}`$XDG_CONFIG_HOME/lsd/colors.yaml`. See 61<https://github.com/lsd-rs/lsd/tree/v1.0.0#color-theme-file-content> for 62supported colors. 63 64If this option is non-empty then the `color.theme` option is 65automatically set to `"custom"`. 66'' ; 67}; 68}; 69 70config = mkIf cfg . enable { 71home . packages = [ pkgs . lsd ]; 72 73programs . bash . shellAliases = mkIf cfg . enableAliases aliases ; 74 75programs . zsh . shellAliases = mkIf cfg . enableAliases aliases ; 76 77programs . fish . shellAliases = mkIf cfg . enableAliases aliases ; 78 79programs . lsd = 80mkIf ( cfg . colors != { }) { settings . color . theme = "custom" ; }; 81 82xdg . configFile . "lsd/colors.yaml" = mkIf ( cfg . colors != { }) { 83source = yamlFormat . generate "lsd-colors" cfg . colors ; 84}; 85 86xdg . configFile . "lsd/config.yaml" = mkIf ( cfg . settings != { }) { 87source = yamlFormat . generate "lsd-config" cfg . settings ; 88}; 89}; 90}