2022-06-16 17:23:12 +00:00
|
|
|
{ lib
|
|
|
|
, stdenvNoCC
|
|
|
|
, fetchFromGitHub
|
|
|
|
, gtk3
|
|
|
|
, gnome-themes-extra
|
|
|
|
, gtk-engine-murrine
|
|
|
|
, sassc
|
|
|
|
, which
|
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-08-12 12:06:08 +00:00
|
|
|
illegalMix = !(lib.elem "nord" tweaks) && !(lib.elem "dracula" tweaks);
|
2022-06-16 17:23:12 +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-08-12 12:06:08 +00:00
|
|
|
version = "unstable-2022-08-01";
|
2022-06-16 17:23:12 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
repo = "gtk";
|
|
|
|
owner = "catppuccin";
|
2022-08-12 12:06:08 +00:00
|
|
|
rev = "87a79fd2bf07accc694455df30a32a82b1b31f4f";
|
|
|
|
sha256 = "sha256-dKHTQva0BYkO6VPNfY/pzRn/V1ghX+tYqbnM9hTAMeE=";
|
2022-06-16 17:23:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ gtk3 sassc which ];
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
mkdir -p $out/share/themes
|
2022-08-12 12:06:08 +00:00
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|