From 95e36dfe74b8d161c28601e33646e2d636026f83 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Sun, 17 Mar 2019 16:37:21 -0500 Subject: [PATCH] lsd: add module --- modules/misc/news.nix | 7 +++++++ modules/modules.nix | 1 + modules/programs/lsd.nix | 41 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 modules/programs/lsd.nix diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 4bb80ba4..131c43e5 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 e1022f7f..1c2015f7 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 00000000..5e145e8c --- /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; + }; +}