nichts/packages/fish/default.nix

46 lines
1.1 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.
{ pkgs, ... }:
let
inherit (pkgs) lib;
inherit (lib.strings) concatStringsSep;
inherit (lib.attrsets) mapAttrsToList;
toml = pkgs.formats.toml { };
2024-11-01 15:54:20 +01:00
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 = mapAttrsToList (k: v: "alias ${k}=\"${v}\"") aliases |> concatStringsSep "\n";
2025-06-04 08:27:12 +02:00
2024-11-01 15:54:20 +01:00
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
(_: {
2024-11-01 15:54:20 +01:00
passthru = {
shellPath = "/bin/fish";
};
})