Programs/common/starship: add upstream nerd font preset

This commit is contained in:
Toast 2023-12-18 09:33:09 +01:00
parent 9a8309def9
commit a80920a663

View file

@ -1,4 +1,8 @@
{ pkgs, ... }: { pkgs, lib, ... }:
with lib;
with builtins;
let let
catppuccinFlavour = "mocha"; catppuccinFlavour = "mocha";
catppuccinStarship = pkgs.fetchFromGitHub { catppuccinStarship = pkgs.fetchFromGitHub {
@ -8,27 +12,46 @@ let
rev = "main"; rev = "main";
hash = "sha256-nsRuxQFKbQkyEI4TXgvAjcroVdG+heKX5Pauq/4Ota0="; hash = "sha256-nsRuxQFKbQkyEI4TXgvAjcroVdG+heKX5Pauq/4Ota0=";
} + /palettes/${catppuccinFlavour}.toml; } + /palettes/${catppuccinFlavour}.toml;
presets = {
nerdFontSymbols = pkgs.fetchurl {
url = "https://starship.rs/presets/toml/nerd-font-symbols.toml";
hash = "sha256-fPmZrfhwM9NakdlJ7Y4rZ5n6JjsqXNEQ9XuFa8en9n0=";
};
};
# -------------------------------- F U N C T I O N S --------------------------------
/*
Gonna be honest, I have no idea how this works, although it seems to work
Stolen from https://gist.github.com/pdalpra/daf339f59288201a6c8ba7dc84e9060e
*/
# Takes a list of attrSets and merges them
mergeAllAttrSets = attrsSets:
foldl' (recursiveUpdate) {} attrsSets;
# Reads a TOML file and parses it
readTomlPreset = file: (fromTOML (readFile file));
in in
{ {
programs.starship = with builtins; { programs.starship = {
enable = true; enable = true;
settings = { settings = mergeAllAttrSets [
(readTomlPreset presets.nerdFontSymbols)
(readTomlPreset catppuccinStarship)
{
nix_shell = { nix_shell = {
disabled = false; disabled = false;
heuristic = true; heuristic = true;
symbol = " ";
}; };
os = { os = {
disabled = false; disabled = false;
symbols.NixOS = " ";
}; };
directory = { directory = {
disabled = false; disabled = false;
read_only = " 󰌾";
}; };
palette = "catppuccin_${catppuccinFlavour}"; palette = "catppuccin_${catppuccinFlavour}";
} // }
# Add the catppuccin palette to the settings file ];
(fromTOML (readFile catppuccinStarship));
}; };
} }