From 0b2b88d41b418c77ceee3e46c319d74ec9d8c4f0 Mon Sep 17 00:00:00 2001 From: Tomas Rivera <137088692+Totorile1@users.noreply.github.com> Date: Mon, 13 Apr 2026 15:29:10 +0200 Subject: [PATCH] Added eza, a replacement for ls --- README.md | 5 +- hosts/laptop/home.nix | 1 + modules/home-manager/eza.nix | 113 +++++++++++++++++++++++++++++++++++ modules/home-manager/zsh.nix | 20 +++++-- 4 files changed, 132 insertions(+), 7 deletions(-) create mode 100644 modules/home-manager/eza.nix diff --git a/README.md b/README.md index 138fe9c..27037f1 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,8 @@ nixos/ - [`krita`](https://krita.org/) and [`inkscape`](https://inkscape.org/) for image editing and drawing - [`anki`](https://apps.ankiweb.net/) flashcards for learning - [`texlive`](https://www.tug.org/texlive/) LaTeX distribution -- [`biber`](https://ctan.org/pkg/biber) bibliography for LaTeX +- [`biber`](https://ctan.org/pkg/biber) bibliography for LaTeX +- [`eza`](https://github.com/eza-community/eza) replacement for `ls` ### System & Hardware - [`bottom`](https://github.com/ClementTsang/bottom) system monitor @@ -210,7 +211,7 @@ All moving macros with ``, `g`, and the recording with `q` are disabled. --- ## Useful Information - +- `ls` is an alias for `eza`. If you want more info than the normal `ls` run `eza`, `l`, `ll` or `la` - `qtbatticon` is a custom battery icon tray, because `cbatticon` and `batticonplus` did not work. Click on it to get more info about the battery. - `man` and `manix` use `fzf` for fuzzy search of pages. - `pkgs-unstable` can be used for unstable nixpkgs packages. diff --git a/hosts/laptop/home.nix b/hosts/laptop/home.nix index 5b65c7a..b054e31 100755 --- a/hosts/laptop/home.nix +++ b/hosts/laptop/home.nix @@ -35,6 +35,7 @@ ../../modules/home-manager/ripgrep.nix # better grep #../../modules/home-manager/obsidian.nix obsidian was replaced with a custom solution ../../modules/home-manager/thunderbird.nix # email client + ../../modules/home-manager/eza.nix # ls replacement ]; #programs.nixvim = { diff --git a/modules/home-manager/eza.nix b/modules/home-manager/eza.nix new file mode 100644 index 0000000..4272ebd --- /dev/null +++ b/modules/home-manager/eza.nix @@ -0,0 +1,113 @@ +{ config, pkgs, ... }: # ls replacement +# see ./zsh.nix for the alias (usefull to se default flags) + +{ + programs.eza = { + enable = true; + enableZshIntegration = true; + theme = { # from https://github.com/eza-community/eza-themes/blob/main/themes/gruvbox-dark.yml + colourful = true; + + filekinds= { + normal = {foreground = "#ebdbb2";}; + directory = {foreground = "#83a598";}; + symlink = {foreground = "#8ec07c";}; + pipe = {foreground = "#928374";}; + block_device = {foreground = "#fb4934";}; + char_device = {foreground = "#fb4934";}; + socket = {foreground = "#665c54";}; + special= {foreground= "#d3869b";}; + executable= {foreground= "#b8bb26";}; + mount_point= {foreground= "#fe8019";}; + }; + perms = { + user_read= {foreground= "#ebdbb2";}; + user_write= {foreground= "#fabd2f";}; + user_execute_file= {foreground= "#b8bb26";}; + user_execute_other= {foreground= "#b8bb26";}; + group_read= {foreground= "#ebdbb2";}; + group_write= {foreground= "#fabd2f";}; + group_execute= {foreground= "#b8bb26";}; + other_read= {foreground= "#bdae93";}; + other_write= {foreground= "#fabd2f";}; + other_execute= {foreground= "#b8bb26";}; + special_user_file= {foreground= "#d3869b";}; + special_other= {foreground= "#928374";}; + attribute= {foreground= "#bdae93";}; + }; + size= { + major= {foreground= "#bdae93";}; + minor= {foreground= "#8ec07c";}; + number_byte= {foreground= "#ebdbb2";}; + number_kilo= {foreground= "#ebdbb2";}; + number_mega= {foreground= "#83a598";}; + number_giga= {foreground= "#d3869b";}; + number_huge= {foreground= "#d3869b";}; + unit_byte= {foreground= "#bdae93";}; + unit_kilo= {foreground= "#83a598";}; + unit_mega= {foreground= "#d3869b";}; + unit_giga= {foreground= "#d3869b";}; + unit_huge= {foreground= "#fe8019";}; + }; + users= { + user_you= {foreground= "#ebdbb2";}; + user_root= {foreground= "#fb4934";}; + user_other= {foreground= "#d3869b";}; + group_yours= {foreground= "#ebdbb2";}; + group_other= {foreground= "#928374";}; + group_root= {foreground= "#fb4934";}; + }; + links= { + normal= {foreground= "#8ec07c";}; + multi_link_file= {foreground= "#fe8019";}; + }; + git= { + new= {foreground= "#b8bb26";}; + modified= {foreground= "#fabd2f";}; + deleted= {foreground= "#fb4934";}; + renamed= {foreground= "#8ec07c";}; + typechange= {foreground= "#d3869b";}; + ignored= {foreground= "#928374";}; + conflicted= {foreground= "#cc241d";}; + }; + git_repo= { + branch_main= {foreground= "#ebdbb2";}; + branch_other= {foreground= "#d3869b";}; + git_clean= {foreground= "#b8bb26";}; + git_dirty= {foreground= "#fb4934";}; + }; + security_context= { + colon= {foreground= "#928374";}; + user= {foreground= "#ebdbb2";}; + role= {foreground= "#d3869b";}; + typ= {foreground= "#665c54";}; + range= {foreground= "#d3869b";}; + }; + file_type= { + image= {foreground= "#fabd2f";}; + video= {foreground= "#fb4934";}; + music= {foreground= "#b8bb26";}; + lossless= {foreground= "#8ec07c";}; + crypto= {foreground= "#928374";}; + document= {foreground= "#ebdbb2";}; + compressed= {foreground= "#d3869b";}; + temp= {foreground= "#cc241d";}; + compiled= {foreground= "#83a598";}; + build= {foreground= "#928374";}; + source= {foreground= "#83a598";}; + punctuation= {foreground= "#928374";}; + date= {foreground= "#fabd2f";}; + inode= {foreground= "#bdae93";}; + blocks= {foreground= "#a89984";}; + header= {foreground= "#ebdbb2";}; + octal= {foreground= "#8ec07c";}; + flags= {foreground= "#d3869b";}; + + symlink_path= {foreground= "#8ec07c";}; + control_char= {foreground= "#83a598";}; + broken_symlink= {foreground= "#fb4934";}; + broken_path_overlay= {foreground= "#928374";}; + }; + }; + }; +} diff --git a/modules/home-manager/zsh.nix b/modules/home-manager/zsh.nix index 9974977..e4eb0ca 100644 --- a/modules/home-manager/zsh.nix +++ b/modules/home-manager/zsh.nix @@ -15,15 +15,25 @@ command cat "$@" fi } + + custom-eza() { # behaves differently if we just call it or if we pipe initContent + if [[ -t 1 ]]; then + eza -hlF -aa --color=always --hyperlink --group-directories-first --show-symlinks --icons=always --git --no-permissions "$@" + else + command eza "$@" + fi + } eval "$(direnv hook zsh)" - fastfetch''\n''; + fastfetch''\n''; shellAliases = { ".." = "z .."; grep = "rg"; - ll = "ls -alF"; - la = "ls -A"; - l = "ls -CF"; - ls = "ls -hA -s --color"; + ll = "custom-eza"; # if there is a special ls just use the big eza + la = "custom-eza"; + l = "custom-eza"; + eza = "custom-eza"; + ls = "\\eza"; # ls -> normal ls. eza more info + tree = "\\eza -hlTF --color=always --hyperlink --group-directories-first --show-symlinks --icons=always --git --no-permissions"; cat = "custom-cat"; pomodoro = "custom-tomato"; librewolf = "kitty --class \"custom-librewolfprofiles\" --name \"Select LibreWolf profile\" --hold custom-librewolfprofiles";