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
, 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
'';