2025-03-18 18:01:59 +11:00
|
|
|
{ config, inputs, lib, pkgs, ... }: {
|
2025-01-24 12:57:53 +11:00
|
|
|
imports = [
|
|
|
|
|
inputs.catppuccin.homeManagerModules.catppuccin
|
|
|
|
|
];
|
|
|
|
|
|
2025-03-06 22:38:08 +11:00
|
|
|
options.catppuccin.colors = lib.mkOption {
|
|
|
|
|
type = lib.types.attrs;
|
|
|
|
|
default = (builtins.fromJSON (builtins.readFile "${inputs.catppuccin-palette}/palette.json"))."${config.catppuccin.flavor}".colors;
|
|
|
|
|
};
|
|
|
|
|
options.catppuccin.hexcolors = lib.mkOption {
|
|
|
|
|
type = lib.types.attrs;
|
|
|
|
|
default = builtins.mapAttrs (name: value: value.hex) config.catppuccin.colors;
|
|
|
|
|
};
|
|
|
|
|
|
2025-03-17 12:51:21 +11:00
|
|
|
config = {
|
|
|
|
|
catppuccin = {
|
2025-03-23 16:58:28 +11:00
|
|
|
accent = lib.mkDefault "pink";
|
2025-03-18 17:29:53 +11:00
|
|
|
flavor = lib.mkDefault "mocha";
|
2025-03-17 12:51:21 +11:00
|
|
|
kitty.enable = true;
|
|
|
|
|
gtk.enable = true;
|
2025-03-17 16:27:44 +11:00
|
|
|
hyprlock.enable = true;
|
2025-03-17 12:51:21 +11:00
|
|
|
nvim.enable = true;
|
|
|
|
|
};
|
2025-03-18 17:29:53 +11:00
|
|
|
|
|
|
|
|
specialisation = {
|
2025-03-23 16:58:28 +11:00
|
|
|
light.configuration.catppuccin.flavor = "latte";
|
|
|
|
|
dark.configuration.catppuccin.flavor = "mocha";
|
2025-03-18 17:29:53 +11:00
|
|
|
};
|
2025-03-18 18:01:59 +11:00
|
|
|
|
|
|
|
|
home.packages = [(pkgs.writeShellScriptBin "theme" ''
|
2025-03-19 13:52:11 +11:00
|
|
|
last_path="$HOME/.local/state/last-theme"
|
|
|
|
|
target="$1"
|
2025-03-19 14:06:32 +11:00
|
|
|
if [ "$target" == "get_last" ]; then
|
|
|
|
|
if [ ! -e "$last_path" ]; then
|
|
|
|
|
echo "no last theme found; assuming dark" >&2
|
|
|
|
|
target="dark"
|
|
|
|
|
else
|
|
|
|
|
target=$(cat "$last_path" | tr -d "\n")
|
|
|
|
|
fi
|
|
|
|
|
echo "$target"
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
2025-03-19 13:52:11 +11:00
|
|
|
if [ "$target" == "restore" ]; then
|
|
|
|
|
echo "restoring theme"
|
|
|
|
|
if [ ! -e "$last_path" ]; then
|
2025-03-19 14:06:32 +11:00
|
|
|
echo "no last theme found; assuming dark" >&2
|
2025-03-19 13:52:11 +11:00
|
|
|
target="dark"
|
|
|
|
|
else
|
|
|
|
|
target=$(cat "$last_path" | tr -d "\n")
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
if [ "$target" != "dark" ] && [ "$target" != "light" ]; then
|
|
|
|
|
echo "invalid theme, valid values: [dark, light, restore]"
|
2025-03-18 18:01:59 +11:00
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
current="$HOME/.local/state/nix/profiles/home-manager"
|
|
|
|
|
cached="$HOME/.local/state/last-parent-specialisation"
|
|
|
|
|
if [ -d "$current/specialisation" ]; then
|
|
|
|
|
if [ -d "$cached" ]; then
|
|
|
|
|
rm -f "$cached"
|
|
|
|
|
fi
|
|
|
|
|
ln -sf "$(readlink -f $current)" "$cached"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ ! -d "$cached/specialisation" ]; then
|
|
|
|
|
echo "no specialisations found"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2025-03-19 13:52:11 +11:00
|
|
|
"$cached/specialisation/$target/activate"
|
|
|
|
|
|
|
|
|
|
echo "$target" > "$last_path"
|
2025-03-18 18:01:59 +11:00
|
|
|
'')];
|
2025-01-24 12:57:53 +11:00
|
|
|
};
|
|
|
|
|
}
|