packages: shell => fish

This commit is contained in:
Bloxx12 2025-06-07 17:32:30 +02:00
commit d852199742
Signed by: faukah
SSH key fingerprint: SHA256:Uj2AXqvtdCA4hn5Hq0ZonhIAyUqI1q4w2sMG3Z1TH7E
7 changed files with 3 additions and 4 deletions

24
packages/fish/aliases.nix Normal file
View file

@ -0,0 +1,24 @@
{pkgs, ...}: let
inherit (pkgs.lib) getExe;
in {
ls = "${getExe pkgs.eza} --icons=never";
la = "${getExe pkgs.eza} --icons=never -lha --git";
g = "git";
n = "nix";
k = "kak";
c = "clear";
cc = "cd ~ && clear";
mv = "mv -iv";
rm = "${pkgs.trash-cli}/bin/trash";
lg = "${getExe pkgs.lazygit}";
ytopus = "yt-dlp -x --embed-metadata --audio-quality 0 --audio-format opus --embed-metadata --embed-thumbnail";
cat = "${getExe pkgs.bat}";
kys = "shutdown now";
cd = "z";
}

View file

@ -0,0 +1 @@
set fish_greeting

46
packages/fish/default.nix Normal file
View file

@ -0,0 +1,46 @@
# This shell setup was originally inspired by sioodmy.
# Some further cool tricks, like using vendor_conf.d to avoid having
# to build fish myself, are taken from viperml's setup.
{pkgs, ...}: let
inherit (pkgs) lib;
inherit (lib.strings) concatStringsSep;
inherit (lib.attrsets) mapAttrsToList;
toml = pkgs.formats.toml {};
starship-config = import ./starship.nix;
aliases = import ./aliases.nix {inherit pkgs;};
vendorConf = "share/fish/vendor_conf.d";
fishinit = import ./fishinit.nix {
inherit
pkgs
aliasesStr
vendorConf
;
};
aliasesStr =
mapAttrsToList (k: v: "alias ${k}=\"${v}\"") aliases
|> concatStringsSep "\n";
packages = import ./packages.nix pkgs;
in
(pkgs.symlinkJoin {
name = "fish";
paths = [pkgs.fish] ++ packages;
nativeBuildInputs = [pkgs.makeWrapper];
postBuild = ''
wrapProgram $out/bin/fish \
--set STARSHIP_CONFIG "${toml.generate "starship.toml" starship-config}" \
--prefix XDG_DATA_DIRS : "${
lib.makeSearchPathOutput "out" "share" [
fishinit
]
}"
'';
})
.overrideAttrs (_: {
passthru = {
shellPath = "/bin/fish";
};
})

View file

@ -0,0 +1,25 @@
{
pkgs,
aliasesStr,
vendorConf,
}:
pkgs.writeTextDir "${vendorConf}/blox_config.fish"
# fish
''
# source ${pkgs.fishPlugins.sponge}/share/zsh-defer/zsh-defer.plugin.zsh
${pkgs.atuin}/bin/atuin init fish | source
${pkgs.zoxide}/bin/zoxide init fish | source
${pkgs.starship}/bin/starship init fish | source
${pkgs.direnv}/bin/direnv hook fish | source
${pkgs.pay-respects}/bin/pay-respects fish --alias f --nocnf | source
# I need to source /etc/profile using foreign-env, to get stuff set by nixos, e.g. environment.systemVariables.
# set -p fish_function_path ${pkgs.fishPlugins.foreign-env}/share/fish/vendor_functions.d
# fenv source /etc/profile
source ${./config.fish}
${aliasesStr}
''

View file

@ -0,0 +1,69 @@
pkgs:
builtins.attrValues {
inherit
(pkgs)
# better cd
zoxide
# pipe viewer
pv
# hex editor
bvi
#better ls
eza
atuin
# better cat
bat
# clipboard
# yazi
serpl
diff-so-fancy
tig
direnv
sesh
mprocs
curlie
entr
procs
sd
# mult
glow
# dua-cli
dust
kondo
# better grep
ripgrep
# IP stuff
dig
# simply the best fetch tool out there
microfetch
fzf
element
difftastic
hexyl
yazi
gnumake
asciinema
inetutils
tokei
starship
onefetch
wget
cpufetch
watchman
yt-dlp
tealdeer
hyperfine
imagemagick
ffmpeg-full
# catimg
timg
nmap
fd
jq
rsync
figlet
unzip
zip
trash-cli
;
}

View file

@ -0,0 +1,38 @@
{
add_newline = false;
command_timeout = 2000;
format = "$hostname$username$directory$shell$nix_shell$jobs$character";
scan_timeout = 1;
character = {
error_symbol = "[λ](bold red)";
success_symbol = "[λ](bold green)";
};
directory = {
format = "[](bold green) [$path]($style) ";
truncation_length = 2;
};
direnv = {
disabled = false;
};
git_status = {
disabled = true;
};
hostname = {
disabled = false;
format = "@[$hostname](bold blue) ";
ssh_only = true;
};
c.symbol = "[ ](black)";
lua.symbol = "[ ](blue) ";
nix_shell.symbol = "[󱄅 ](blue) ";
nodejs.symbol = "[󰎙 ](yellow)";
package.symbol = "📦 ";
python.symbol = "[ ](blue) ";
rust.symbol = "[ ](red) ";
username.format = "[$user]($style) in ";
}