2019-03-17 22:37:21 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.programs.lsd;
|
|
|
|
|
2021-03-08 05:20:00 +01:00
|
|
|
yamlFormat = pkgs.formats.yaml { };
|
|
|
|
|
2019-03-17 22:37:21 +01:00
|
|
|
aliases = {
|
|
|
|
ls = "${pkgs.lsd}/bin/lsd";
|
2021-03-08 05:20:00 +01:00
|
|
|
ll = "${pkgs.lsd}/bin/lsd -l";
|
2023-06-30 21:47:03 +02:00
|
|
|
la = "${pkgs.lsd}/bin/lsd -A";
|
2021-03-08 05:20:00 +01:00
|
|
|
lt = "${pkgs.lsd}/bin/lsd --tree";
|
2023-06-30 21:47:03 +02:00
|
|
|
lla = "${pkgs.lsd}/bin/lsd -lA";
|
|
|
|
llt = "${pkgs.lsd}/bin/lsd -l --tree";
|
2019-03-17 22:37:21 +01:00
|
|
|
};
|
|
|
|
|
2020-02-02 00:39:17 +01:00
|
|
|
in {
|
2023-06-22 10:16:28 +02:00
|
|
|
meta.maintainers = [ ];
|
2019-03-17 22:37:21 +01:00
|
|
|
|
|
|
|
options.programs.lsd = {
|
2023-07-02 01:45:18 +02:00
|
|
|
enable = mkEnableOption "lsd";
|
2019-03-17 22:37:21 +01:00
|
|
|
|
|
|
|
enableAliases = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.bool;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2019-03-17 22:37:21 +01:00
|
|
|
Whether to enable recommended lsd aliases.
|
|
|
|
'';
|
|
|
|
};
|
2021-03-08 05:20:00 +01:00
|
|
|
|
|
|
|
settings = mkOption {
|
|
|
|
type = yamlFormat.type;
|
|
|
|
default = { };
|
|
|
|
example = {
|
|
|
|
date = "relative";
|
|
|
|
ignore-globs = [ ".git" ".hg" ];
|
|
|
|
};
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2021-03-08 05:20:00 +01:00
|
|
|
Configuration written to
|
2023-07-01 01:30:13 +02:00
|
|
|
{file}`$XDG_CONFIG_HOME/lsd/config.yaml`. See
|
|
|
|
<https://github.com/Peltoche/lsd#config-file-content>
|
2021-03-08 05:20:00 +01:00
|
|
|
for supported values.
|
|
|
|
'';
|
|
|
|
};
|
2023-09-22 08:38:30 +02:00
|
|
|
|
|
|
|
colors = mkOption {
|
|
|
|
type = yamlFormat.type;
|
|
|
|
default = { };
|
|
|
|
example = {
|
|
|
|
size = {
|
|
|
|
none = "grey";
|
|
|
|
small = "yellow";
|
|
|
|
large = "dark_yellow";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
description = ''
|
|
|
|
Configuration written to {file}`$XDG_CONFIG_HOME/lsd/colors.yaml`. See
|
|
|
|
<https://github.com/lsd-rs/lsd/tree/v1.0.0#color-theme-file-content> for
|
|
|
|
supported colors.
|
|
|
|
|
|
|
|
If this option is non-empty then the `color.theme` option is
|
|
|
|
automatically set to `"custom"`.
|
|
|
|
'';
|
|
|
|
};
|
2019-03-17 22:37:21 +01: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 07:09:51 +01:00
|
|
|
|
|
|
|
programs.fish.shellAliases = mkIf cfg.enableAliases aliases;
|
2021-03-08 05:20:00 +01:00
|
|
|
|
2023-09-22 08:38:30 +02:00
|
|
|
programs.lsd =
|
|
|
|
mkIf (cfg.colors != { }) { settings.color.theme = "custom"; };
|
|
|
|
|
|
|
|
xdg.configFile."lsd/colors.yaml" = mkIf (cfg.colors != { }) {
|
|
|
|
source = yamlFormat.generate "lsd-colors" cfg.colors;
|
|
|
|
};
|
|
|
|
|
2021-03-08 05:20:00 +01:00
|
|
|
xdg.configFile."lsd/config.yaml" = mkIf (cfg.settings != { }) {
|
|
|
|
source = yamlFormat.generate "lsd-config" cfg.settings;
|
|
|
|
};
|
2019-03-17 22:37:21 +01:00
|
|
|
};
|
|
|
|
}
|