mirror of
https://github.com/nix-community/home-manager.git
synced 2024-12-14 11:57:55 +00:00
17ce23ea56
The current `lla` alias, together with the `total-size` option try to get the size of the `..` directory, and for this has to recursively open all sibling folders. This may be super slow if some of those siblings contain too many files, and raise a ton of useless errors if some of those siblings contains non-readable files. I'm suggesting to use `-A` instead, which will skip the obvious `.` and `..` folders. While here, I think we could also add `llt`.
63 lines
1.4 KiB
Nix
63 lines
1.4 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.programs.lsd;
|
|
|
|
yamlFormat = pkgs.formats.yaml { };
|
|
|
|
aliases = {
|
|
ls = "${pkgs.lsd}/bin/lsd";
|
|
ll = "${pkgs.lsd}/bin/lsd -l";
|
|
la = "${pkgs.lsd}/bin/lsd -A";
|
|
lt = "${pkgs.lsd}/bin/lsd --tree";
|
|
lla = "${pkgs.lsd}/bin/lsd -lA";
|
|
llt = "${pkgs.lsd}/bin/lsd -l --tree";
|
|
};
|
|
|
|
in {
|
|
meta.maintainers = [ ];
|
|
|
|
options.programs.lsd = {
|
|
enable = mkEnableOption "lsd";
|
|
|
|
enableAliases = mkOption {
|
|
default = false;
|
|
type = types.bool;
|
|
description = ''
|
|
Whether to enable recommended lsd aliases.
|
|
'';
|
|
};
|
|
|
|
settings = mkOption {
|
|
type = yamlFormat.type;
|
|
default = { };
|
|
example = {
|
|
date = "relative";
|
|
ignore-globs = [ ".git" ".hg" ];
|
|
};
|
|
description = ''
|
|
Configuration written to
|
|
<filename>$XDG_CONFIG_HOME/lsd/config.yaml</filename>. See
|
|
<link xlink:href="https://github.com/Peltoche/lsd#config-file-content"/>
|
|
for supported values.
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
home.packages = [ pkgs.lsd ];
|
|
|
|
programs.bash.shellAliases = mkIf cfg.enableAliases aliases;
|
|
|
|
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;
|
|
};
|
|
};
|
|
}
|