From 7cf69a3b8db6cdd451f83bfe1a6de3a07a6a295f Mon Sep 17 00:00:00 2001 From: Christian Gram Kalhauge Date: Fri, 9 Apr 2021 16:08:06 +0200 Subject: [PATCH] exa: add module Exa is a 'ls' alternative with more sane colorscheme than lsd on white backgrounds. --- .github/CODEOWNERS | 2 ++ modules/lib/maintainers.nix | 6 ++++++ modules/misc/news.nix | 10 ++++++++++ modules/modules.nix | 1 + modules/programs/exa.nix | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 55 insertions(+) create mode 100644 modules/programs/exa.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5bfda4a72..475150fd4 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -57,6 +57,8 @@ /modules/programs/emacs.nix @rycee +/modules/programs/exa.nix @kalhauge + /modules/programs/firefox.nix @rycee /modules/programs/gh.nix @Gerschtli diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix index 220dccf7f..e0aaedb50 100644 --- a/modules/lib/maintainers.nix +++ b/modules/lib/maintainers.nix @@ -31,6 +31,12 @@ github = "olmokramer"; githubId = 3612514; }; + kalhauge = { + name = "Christian Gram Kalhauge"; + email = "kalhauge@users.noreply.github.com"; + github = "kalhauge"; + githubId = 1182166; + }; kubukoz = { name = "Jakub Kozłowski"; email = "kubukoz@users.noreply.github.com"; diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 88fcf075b..88193c55c 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -1863,6 +1863,7 @@ in lists to polybar-style 'foo-0, foo-1, ...' lists. ''; } + { time = "2021-02-25T22:36:43+00:00"; condition = config.programs.git.enable && any (msmtp: msmtp.enable) @@ -1873,6 +1874,7 @@ in 'accounts.email.accounts..msmtp.enable' is true. ''; } + { time = "2021-03-03T22:16:05+00:00"; message = '' @@ -1880,6 +1882,7 @@ in https://no-color.org/. ''; } + { time = "2021-03-29T21:05:50+00:00"; message = '' @@ -1887,6 +1890,13 @@ in applied after 'programs.dircolors.settings'. ''; } + + { + time = "2021-04-11T20:44:54+00:00"; + message = '' + A new module is available: 'programs.exa'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 11367e72f..0e4e7fef2 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -63,6 +63,7 @@ let (loadModule ./programs/direnv.nix { }) (loadModule ./programs/eclipse.nix { }) (loadModule ./programs/emacs.nix { }) + (loadModule ./programs/exa.nix { }) (loadModule ./programs/feh.nix { }) (loadModule ./programs/firefox.nix { }) (loadModule ./programs/fish.nix { }) diff --git a/modules/programs/exa.nix b/modules/programs/exa.nix new file mode 100644 index 000000000..771e4e65c --- /dev/null +++ b/modules/programs/exa.nix @@ -0,0 +1,36 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.exa; + + aliases = { + ls = "${pkgs.exa}/bin/exa"; + ll = "${pkgs.exa}/bin/exa -l"; + la = "${pkgs.exa}/bin/exa -a"; + lt = "${pkgs.exa}/bin/exa --tree"; + lla = "${pkgs.exa}/bin/exa -la"; + }; + +in { + meta.maintainers = [ maintainers.kalhauge ]; + + options.programs.exa = { + enable = + mkEnableOption "exa, a modern replacement for ls"; + enableAliases = mkEnableOption "recommended exa aliases"; + }; + + config = mkIf cfg.enable { + home.packages = [ pkgs.exa ]; + + programs.bash.shellAliases = mkIf cfg.enableAliases aliases; + + programs.zsh.shellAliases = mkIf cfg.enableAliases aliases; + + programs.fish.shellAliases = mkIf cfg.enableAliases aliases; + + }; +}