diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 4bb80ba4f..131c43e5e 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -1005,6 +1005,13 @@ in A new module is available: 'programs.bat'. ''; } + + { + time = "2019-03-19T23:07:34+00:00"; + message = '' + A new module is available: 'programs.lsd'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index e1022f7f6..1c2015f72 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -60,6 +60,7 @@ let (loadModule ./programs/jq.nix { }) (loadModule ./programs/keychain.nix { }) (loadModule ./programs/lesspipe.nix { }) + (loadModule ./programs/lsd.nix { }) (loadModule ./programs/man.nix { }) (loadModule ./programs/matplotlib.nix { }) (loadModule ./programs/mbsync.nix { }) diff --git a/modules/programs/lsd.nix b/modules/programs/lsd.nix new file mode 100644 index 000000000..5e145e8c6 --- /dev/null +++ b/modules/programs/lsd.nix @@ -0,0 +1,41 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.lsd; + + aliases = { + ls = "${pkgs.lsd}/bin/lsd"; + ll = "ls -l"; + la = "ls -a"; + lt = "ls --tree"; + lla ="ls -la"; + }; + +in + +{ + meta.maintainers = [ maintainers.marsam ]; + + options.programs.lsd = { + enable = mkEnableOption "lsd"; + + enableAliases = mkOption { + default = false; + type = types.bool; + description = '' + Whether to enable recommended lsd aliases. + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ pkgs.lsd ]; + + programs.bash.shellAliases = mkIf cfg.enableAliases aliases; + + programs.zsh.shellAliases = mkIf cfg.enableAliases aliases; + }; +}