2019-03-17 21:37:21 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.programs.lsd;
|
|
|
|
|
2021-03-08 04:20:00 +00:00
|
|
|
yamlFormat = pkgs.formats.yaml { };
|
|
|
|
|
2019-03-17 21:37:21 +00:00
|
|
|
aliases = {
|
|
|
|
ls = "${pkgs.lsd}/bin/lsd";
|
2021-03-08 04:20:00 +00:00
|
|
|
ll = "${pkgs.lsd}/bin/lsd -l";
|
|
|
|
la = "${pkgs.lsd}/bin/lsd -a";
|
|
|
|
lt = "${pkgs.lsd}/bin/lsd --tree";
|
|
|
|
lla = "${pkgs.lsd}/bin/lsd -la";
|
2019-03-17 21:37:21 +00:00
|
|
|
};
|
|
|
|
|
2020-02-01 23:39:17 +00:00
|
|
|
in {
|
2023-06-22 08:16:28 +00:00
|
|
|
meta.maintainers = [ ];
|
2019-03-17 21:37:21 +00:00
|
|
|
|
|
|
|
options.programs.lsd = {
|
|
|
|
enable = mkEnableOption "lsd";
|
|
|
|
|
|
|
|
enableAliases = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.bool;
|
|
|
|
description = ''
|
|
|
|
Whether to enable recommended lsd aliases.
|
|
|
|
'';
|
|
|
|
};
|
2021-03-08 04:20:00 +00:00
|
|
|
|
|
|
|
settings = mkOption {
|
|
|
|
type = yamlFormat.type;
|
|
|
|
default = { };
|
|
|
|
example = {
|
|
|
|
date = "relative";
|
|
|
|
ignore-globs = [ ".git" ".hg" ];
|
|
|
|
};
|
|
|
|
description = ''
|
|
|
|
Configuration written to
|
2021-12-09 03:02:00 +00:00
|
|
|
<filename>$XDG_CONFIG_HOME/lsd/config.yaml</filename>. See
|
2021-03-08 04:20:00 +00:00
|
|
|
<link xlink:href="https://github.com/Peltoche/lsd#config-file-content"/>
|
|
|
|
for supported values.
|
|
|
|
'';
|
|
|
|
};
|
2019-03-17 21:37:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
home.packages = [ pkgs.lsd ];
|
|
|
|
|
|
|
|
programs.bash.shellAliases = mkIf cfg.enableAliases aliases;
|
|
|
|
|
|
|
|
programs.zsh.shellAliases = mkIf cfg.enableAliases aliases;
|
2020-01-06 06:09:51 +00:00
|
|
|
|
|
|
|
programs.fish.shellAliases = mkIf cfg.enableAliases aliases;
|
2021-03-08 04:20:00 +00:00
|
|
|
|
|
|
|
xdg.configFile."lsd/config.yaml" = mkIf (cfg.settings != { }) {
|
|
|
|
source = yamlFormat.generate "lsd-config" cfg.settings;
|
|
|
|
};
|
2019-03-17 21:37:21 +00:00
|
|
|
};
|
|
|
|
}
|