2022-06-16 17:23:12 +00:00
|
|
|
{ lib
|
|
|
|
, stdenvNoCC
|
|
|
|
, fetchFromGitHub
|
|
|
|
, gtk3
|
|
|
|
, gnome-themes-extra
|
|
|
|
, gtk-engine-murrine
|
|
|
|
, sassc
|
2022-08-12 12:06:08 +00:00
|
|
|
, tweaks ? [ ]
|
|
|
|
, size ? "standard"
|
2022-06-16 17:23:12 +00:00
|
|
|
}:
|
|
|
|
let
|
|
|
|
validSizes = [ "standard" "compact" ];
|
2022-08-12 12:06:08 +00:00
|
|
|
validTweaks = [ "nord" "dracula" "black" "rimless" "normal" ];
|
2022-06-16 17:23:12 +00:00
|
|
|
|
|
|
|
unknownTweaks = lib.subtractLists validTweaks tweaks;
|
2022-09-09 14:08:57 +00:00
|
|
|
illegalMix = (lib.elem "nord" tweaks) && (lib.elem "dracula" tweaks);
|
2022-06-16 17:23:12 +00:00
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
assertIllegal = lib.assertMsg (!illegalMix) ''
|
2022-08-12 12:06:08 +00:00
|
|
|
Tweaks "nord" and "dracula" cannot be mixed. Tweaks: ${toString tweaks}
|
2022-06-16 17:23:12 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
assertSize = lib.assertMsg (lib.elem size validSizes) ''
|
2022-08-12 12:06:08 +00:00
|
|
|
You entered a wrong size: ${size}
|
2022-06-16 17:23:12 +00:00
|
|
|
Valid sizes are: ${toString validSizes}
|
|
|
|
'';
|
|
|
|
|
|
|
|
assertUnknown = lib.assertMsg (unknownTweaks == [ ]) ''
|
|
|
|
You entered wrong tweaks: ${toString unknownTweaks}
|
|
|
|
Valid tweaks are: ${toString validTweaks}
|
|
|
|
'';
|
|
|
|
in
|
|
|
|
|
|
|
|
assert assertIllegal;
|
|
|
|
assert assertSize;
|
|
|
|
assert assertUnknown;
|
|
|
|
|
|
|
|
stdenvNoCC.mkDerivation rec {
|
|
|
|
pname = "catppuccin-gtk";
|
2022-09-09 14:08:57 +00:00
|
|
|
version = "0.2.7";
|
2022-06-16 17:23:12 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
repo = "gtk";
|
|
|
|
owner = "catppuccin";
|
2022-09-09 14:08:57 +00:00
|
|
|
rev = "v-${version}";
|
|
|
|
sha256 = "sha256-oTAfURHMWqlKHk4CNz5cn6vO/7GmQJM2rXXGDz2e+0w=";
|
2022-06-16 17:23:12 +00:00
|
|
|
};
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
nativeBuildInputs = [ gtk3 sassc ];
|
2022-06-16 17:23:12 +00:00
|
|
|
|
|
|
|
buildInputs = [ gnome-themes-extra ];
|
|
|
|
|
|
|
|
propagatedUserEnvPkgs = [ gtk-engine-murrine ];
|
|
|
|
|
|
|
|
postPatch = ''
|
2022-08-12 12:06:08 +00:00
|
|
|
patchShebangs --build clean-old-theme.sh install.sh
|
2022-06-16 17:23:12 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
|
|
|
|
bash install.sh -d $out/share/themes -t all \
|
2022-06-16 17:23:12 +00:00
|
|
|
${lib.optionalString (size != "") "-s ${size}"} \
|
|
|
|
${lib.optionalString (tweaks != []) "--tweaks " + builtins.toString tweaks}
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
2022-08-12 12:06:08 +00:00
|
|
|
description = "Soothing pastel theme for GTK";
|
2022-06-16 17:23:12 +00:00
|
|
|
homepage = "https://github.com/catppuccin/gtk";
|
|
|
|
license = licenses.gpl3Plus;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = [ maintainers.fufexan ];
|
|
|
|
};
|
|
|
|
}
|