catppuccin-gtk: 0.2.7 -> 0.4.1

This commit is contained in:
Mihai Fufezan 2022-12-09 21:58:03 +02:00
parent 64c7c5df40
commit a46dffd912
No known key found for this signature in database
GPG Key ID: 5899325F2F120900

View File

@ -2,67 +2,71 @@
, stdenvNoCC , stdenvNoCC
, fetchFromGitHub , fetchFromGitHub
, gtk3 , gtk3
, colloid-gtk-theme
, gnome-themes-extra , gnome-themes-extra
, gtk-engine-murrine , gtk-engine-murrine
, python3
, sassc , sassc
, tweaks ? [ ] , accents ? [ "blue" ]
, size ? "standard" , size ? "standard"
, tweaks ? [ ]
, variant ? "frappe"
}: }:
let let
validAccents = [ "blue" "flamingo" "green" "lavender" "maroon" "mauve" "peach" "pink" "red" "rosewater" "sapphire" "sky" "teal" "yellow" ];
validSizes = [ "standard" "compact" ]; validSizes = [ "standard" "compact" ];
validTweaks = [ "nord" "dracula" "black" "rimless" "normal" ]; validTweaks = [ "black" "rimless" "normal" ];
validVariants = [ "latte" "frappe" "macchiato" "mocha" ];
unknownTweaks = lib.subtractLists validTweaks tweaks; pname = "catppuccin-gtk";
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}
'';
in in
assert assertIllegal; lib.checkListOfEnum "${pname}: theme accent" validAccents accents
assert assertSize; lib.checkListOfEnum "${pname}: color variant" validVariants [variant]
assert assertUnknown; lib.checkListOfEnum "${pname}: size variant" validSizes [size]
lib.checkListOfEnum "${pname}: tweaks" validTweaks tweaks
stdenvNoCC.mkDerivation rec { stdenvNoCC.mkDerivation rec {
pname = "catppuccin-gtk"; inherit pname;
version = "0.2.7"; version = "0.4.1";
src = fetchFromGitHub { src = fetchFromGitHub {
repo = "gtk";
owner = "catppuccin"; owner = "catppuccin";
rev = "v-${version}"; repo = "gtk";
sha256 = "sha256-oTAfURHMWqlKHk4CNz5cn6vO/7GmQJM2rXXGDz2e+0w="; rev = "v${version}";
sha256 = "sha256-dzRXt9/OdPyiy3mu9pmPYeu69OXCnR+zEqbD1C5BKqM=";
}; };
nativeBuildInputs = [ gtk3 sassc ]; nativeBuildInputs = [ gtk3 sassc ];
buildInputs = [ gnome-themes-extra ]; buildInputs = [
gnome-themes-extra
(python3.withPackages (ps: [ ps.catppuccin ]))
];
propagatedUserEnvPkgs = [ gtk-engine-murrine ]; propagatedUserEnvPkgs = [ gtk-engine-murrine ];
postUnpack = ''
rm -rf source/colloid
cp -r ${colloid-gtk-theme.src} source/colloid
chmod -R +w source/colloid
'';
postPatch = '' postPatch = ''
patchShebangs --build clean-old-theme.sh install.sh patchShebangs --build colloid/clean-old-theme.sh colloid/install.sh
''; '';
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
mkdir -p $out/share/themes
export HOME=$(mktemp -d) export HOME=$(mktemp -d)
bash install.sh -d $out/share/themes -t all \ python3 install.py ${variant} \
${lib.optionalString (size != "") "-s ${size}"} \ ${lib.optionalString (accents != []) "--accent " + builtins.toString accents} \
${lib.optionalString (tweaks != []) "--tweaks " + builtins.toString tweaks} ${lib.optionalString (size != []) "--size " + size} \
${lib.optionalString (tweaks != []) "--tweaks " + builtins.toString tweaks} \
--dest $out/share/themes
runHook postInstall runHook postInstall
''; '';