fix(fish): fixing nixpkgs module with lib.getExe

This commit is contained in:
2025-11-02 16:30:56 +01:00
parent f0fb53b480
commit 15bc0f211f

View File

@@ -1,17 +1,13 @@
{ {
config, config,
lib, lib,
pkgs,
... ...
}: }: let
let
inherit (lib) mkIf mkEnableOption mkMerge; inherit (lib) mkIf mkEnableOption mkMerge;
packageNames = map (p: p.pname or p.name or null) config.home.packages;
hasPackage = name: lib.any (x: x == name) packageNames;
hasEza = hasPackage "eza";
cfg = config.nixos.programs.fish; cfg = config.nixos.programs.fish;
in in {
{
options = { options = {
nixos.programs.fish = { nixos.programs.fish = {
enable = mkEnableOption "Enables fish shell"; enable = mkEnableOption "Enables fish shell";
@@ -57,12 +53,13 @@ in
nset = "$EDITOR /home/$USER/.nix-config/hosts/$hostname/settings.nix"; nset = "$EDITOR /home/$USER/.nix-config/hosts/$hostname/settings.nix";
nixosmodules = "$EDITOR /home/$USER/.nix-config/hosts/$hostname/modules.nix"; nixosmodules = "$EDITOR /home/$USER/.nix-config/hosts/$hostname/modules.nix";
nmod = "$EDITOR /home/$USER/.nix-config/hosts/$hostname/modules.nix"; nmod = "$EDITOR /home/$USER/.nix-config/hosts/$hostname/modules.nix";
ls = mkIf hasEza "eza"; ls = lib.getExe pkgs.eza;
tree = mkIf hasEza "eza --tree --icons=always"; tree = "${lib.getExe pkgs.eza} --tree --icons=always";
# Clear screen and scrollback # Clear screen and scrollback
clear = "printf '\\033[2J\\033[3J\\033[1;1H'"; clear = "printf '\\033[2J\\033[3J\\033[1;1H'";
}; };
interactiveShellInit = # fish interactiveShellInit =
# fish
'' ''
# Open command buffer in vim when alt+e is pressed # Open command buffer in vim when alt+e is pressed
bind \ee edit_command_buffer bind \ee edit_command_buffer