shell: stop fish from having to be built every time

Drop the patch to fish source code, instead opting
to employ fish's inbuilt share/fish/vendor_conf.d
to add custom code to fish.

This is both a bit simpler, and makes it so fish does not
have to be compiled on every update to it's source / to my configuration.
This commit is contained in:
Bloxx12 2025-06-04 08:29:51 +02:00
commit 24f35c4ccd
Signed by: faukah
SSH key fingerprint: SHA256:Uj2AXqvtdCA4hn5Hq0ZonhIAyUqI1q4w2sMG3Z1TH7E
3 changed files with 31 additions and 27 deletions

View file

@ -1,34 +1,42 @@
# This shell setup was inspired by sioodmy. Check out his setup!
# 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;};
fishinit = import ./fishinit.nix {
inherit
pkgs
aliasesStr
vendorConf
;
};
aliasesStr =
mapAttrsToList (k: v: "alias ${k}=\"${v}\"") aliases
|> concatStringsSep "\n";
packages = import ./packages.nix pkgs;
# this was taken from viperml, check out his config for this!
custom-fish = pkgs.fish.overrideAttrs (old: {
patches = [./fish-on-tmpfs.patch];
doCheck = false;
postInstall =
old.postInstall
+ ''
echo "source ${fishinit}" >> $out/etc/fish/config.fish
'';
});
in
(pkgs.symlinkJoin {
name = "fish";
paths = [custom-fish] ++ packages;
paths = [pkgs.fish] ++ packages;
nativeBuildInputs = [pkgs.makeWrapper];
postBuild = ''
wrapProgram $out/bin/fish --set STARSHIP_CONFIG "${toml.generate "starship.toml" starship-config}" \
wrapProgram $out/bin/fish \
--set STARSHIP_CONFIG "${toml.generate "starship.toml" starship-config}" \
--prefix XDG_DATA_DIRS : "${
lib.makeSearchPathOutput "out" "share" [
fishinit
]
}"
'';
})
.overrideAttrs (_: {