nichts/packages/fish/default.nix

47 lines
1.2 KiB
Nix
Raw Normal View History

# 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.
2024-11-03 15:29:32 +01:00
{pkgs, ...}: let
inherit (pkgs) lib;
inherit (lib.strings) concatStringsSep;
inherit (lib.attrsets) mapAttrsToList;
2024-11-01 15:54:20 +01:00
toml = pkgs.formats.toml {};
starship-config = import ./starship.nix;
aliases = import ./aliases.nix {inherit pkgs;};
vendorConf = "share/fish/vendor_conf.d";
2024-11-01 15:54:20 +01:00
fishinit = import ./fishinit.nix {
inherit
pkgs
aliasesStr
vendorConf
;
};
2024-11-01 15:54:20 +01:00
aliasesStr =
2025-06-04 08:27:12 +02:00
mapAttrsToList (k: v: "alias ${k}=\"${v}\"") aliases
|> concatStringsSep "\n";
2024-11-01 15:54:20 +01:00
packages = import ./packages.nix pkgs;
in
(pkgs.symlinkJoin {
2025-03-31 11:32:19 +02:00
name = "fish";
paths = [pkgs.fish] ++ packages;
nativeBuildInputs = [pkgs.makeWrapper];
2024-11-01 15:54:20 +01:00
postBuild = ''
wrapProgram $out/bin/fish \
--set STARSHIP_CONFIG "${toml.generate "starship.toml" starship-config}" \
--prefix XDG_DATA_DIRS : "${
lib.makeSearchPathOutput "out" "share" [
fishinit
]
}"
2024-11-01 15:54:20 +01:00
'';
})
.overrideAttrs (_: {
passthru = {
shellPath = "/bin/fish";
};
})