From a46dffd91284a7fd2b36893c2e92a423bba50608 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Fri, 9 Dec 2022 21:58:03 +0200 Subject: [PATCH] catppuccin-gtk: 0.2.7 -> 0.4.1 --- pkgs/data/themes/catppuccin-gtk/default.nix | 66 +++++++++++---------- 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/pkgs/data/themes/catppuccin-gtk/default.nix b/pkgs/data/themes/catppuccin-gtk/default.nix index 4158d4384d47..47cdc6e8ce9c 100644 --- a/pkgs/data/themes/catppuccin-gtk/default.nix +++ b/pkgs/data/themes/catppuccin-gtk/default.nix @@ -2,67 +2,71 @@ , stdenvNoCC , fetchFromGitHub , gtk3 +, colloid-gtk-theme , gnome-themes-extra , gtk-engine-murrine +, python3 , sassc -, tweaks ? [ ] +, accents ? [ "blue" ] , size ? "standard" +, tweaks ? [ ] +, variant ? "frappe" }: let + validAccents = [ "blue" "flamingo" "green" "lavender" "maroon" "mauve" "peach" "pink" "red" "rosewater" "sapphire" "sky" "teal" "yellow" ]; validSizes = [ "standard" "compact" ]; - validTweaks = [ "nord" "dracula" "black" "rimless" "normal" ]; + validTweaks = [ "black" "rimless" "normal" ]; + validVariants = [ "latte" "frappe" "macchiato" "mocha" ]; - unknownTweaks = lib.subtractLists validTweaks tweaks; - illegalMix = (lib.elem "nord" tweaks) && (lib.elem "dracula" tweaks); - - assertIllegal = lib.assertMsg (!illegalMix) '' - Tweaks "nord" and "dracula" cannot be mixed. Tweaks: ${toString tweaks} - ''; - - assertSize = lib.assertMsg (lib.elem size validSizes) '' - You entered a wrong size: ${size} - Valid sizes are: ${toString validSizes} - ''; - - assertUnknown = lib.assertMsg (unknownTweaks == [ ]) '' - You entered wrong tweaks: ${toString unknownTweaks} - Valid tweaks are: ${toString validTweaks} - ''; + pname = "catppuccin-gtk"; in -assert assertIllegal; -assert assertSize; -assert assertUnknown; +lib.checkListOfEnum "${pname}: theme accent" validAccents accents +lib.checkListOfEnum "${pname}: color variant" validVariants [variant] +lib.checkListOfEnum "${pname}: size variant" validSizes [size] +lib.checkListOfEnum "${pname}: tweaks" validTweaks tweaks stdenvNoCC.mkDerivation rec { - pname = "catppuccin-gtk"; - version = "0.2.7"; + inherit pname; + version = "0.4.1"; src = fetchFromGitHub { - repo = "gtk"; owner = "catppuccin"; - rev = "v-${version}"; - sha256 = "sha256-oTAfURHMWqlKHk4CNz5cn6vO/7GmQJM2rXXGDz2e+0w="; + repo = "gtk"; + rev = "v${version}"; + sha256 = "sha256-dzRXt9/OdPyiy3mu9pmPYeu69OXCnR+zEqbD1C5BKqM="; }; nativeBuildInputs = [ gtk3 sassc ]; - buildInputs = [ gnome-themes-extra ]; + buildInputs = [ + gnome-themes-extra + (python3.withPackages (ps: [ ps.catppuccin ])) + ]; propagatedUserEnvPkgs = [ gtk-engine-murrine ]; + postUnpack = '' + rm -rf source/colloid + cp -r ${colloid-gtk-theme.src} source/colloid + chmod -R +w source/colloid + ''; + postPatch = '' - patchShebangs --build clean-old-theme.sh install.sh + patchShebangs --build colloid/clean-old-theme.sh colloid/install.sh ''; installPhase = '' runHook preInstall + mkdir -p $out/share/themes export HOME=$(mktemp -d) - bash install.sh -d $out/share/themes -t all \ - ${lib.optionalString (size != "") "-s ${size}"} \ - ${lib.optionalString (tweaks != []) "--tweaks " + builtins.toString tweaks} + python3 install.py ${variant} \ + ${lib.optionalString (accents != []) "--accent " + builtins.toString accents} \ + ${lib.optionalString (size != []) "--size " + size} \ + ${lib.optionalString (tweaks != []) "--tweaks " + builtins.toString tweaks} \ + --dest $out/share/themes runHook postInstall '';