From 6bece8c8004cf9a3cd7f814bb70fa182adcdbc11 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Sat, 14 May 2022 19:35:41 +0300 Subject: [PATCH] catppuccin-gtk: init at unstable-2022-02-24 --- pkgs/data/themes/catppuccin-gtk/default.nix | 87 +++++++++++++++++++ .../data/themes/catppuccin-gtk/grey-fix.patch | 12 +++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 101 insertions(+) create mode 100644 pkgs/data/themes/catppuccin-gtk/default.nix create mode 100644 pkgs/data/themes/catppuccin-gtk/grey-fix.patch diff --git a/pkgs/data/themes/catppuccin-gtk/default.nix b/pkgs/data/themes/catppuccin-gtk/default.nix new file mode 100644 index 00000000000..ec8c9310024 --- /dev/null +++ b/pkgs/data/themes/catppuccin-gtk/default.nix @@ -0,0 +1,87 @@ +{ lib +, stdenvNoCC +, fetchFromGitHub +, gtk3 +, gnome-themes-extra +, gtk-engine-murrine +, sassc +, which +, tweaks ? [ ] # can be "nord" "black" "rimless". cannot mix "nord" and "black" +, size ? "standard" # can be "standard" "compact" +}: +let + validSizes = [ "standard" "compact" ]; + validTweaks = [ "nord" "black" "rimless" ]; + + unknownTweaks = lib.subtractLists validTweaks tweaks; + illegalMix = !(lib.elem "nord" tweaks) && !(lib.elem "black" tweaks); + + assertIllegal = lib.assertMsg illegalMix '' + Tweaks "nord" and "black" cannot be mixed. Tweaks: ${toString tweaks} + ''; + + assertSize = lib.assertMsg (lib.elem size validSizes) '' + You entered wrong size: ${size} + 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"; + version = "unstable-2022-02-24"; + + src = fetchFromGitHub { + repo = "gtk"; + owner = "catppuccin"; + rev = "359c584f607c021fcc657ce77b81c181ebaff6de"; + sha256 = "sha256-AVhFw1XTnkU0hoM+UyjT7ZevLkePybBATJUMLqRytpk="; + }; + + nativeBuildInputs = [ gtk3 sassc which ]; + + buildInputs = [ gnome-themes-extra ]; + + propagatedUserEnvPkgs = [ gtk-engine-murrine ]; + + patches = [ + # Allows installing with `-t all`. Works around missing grey assets. + # https://github.com/catppuccin/gtk/issues/17 + ./grey-fix.patch + ]; + + postPatch = '' + patchShebangs --build scripts/* + substituteInPlace Makefile \ + --replace '$(shell git rev-parse --show-toplevel)' "$PWD" + substituteInPlace 'scripts/install.sh' \ + --replace '$(git rev-parse --show-toplevel)' "$PWD" + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out/share/themes + bash scripts/install.sh -d $out/share/themes -t all \ + ${lib.optionalString (size != "") "-s ${size}"} \ + ${lib.optionalString (tweaks != []) "--tweaks " + builtins.toString tweaks} + + runHook postInstall + ''; + + meta = with lib; { + description = "Soothing pastel theme for GTK3"; + homepage = "https://github.com/catppuccin/gtk"; + license = licenses.gpl3Plus; + platforms = platforms.linux; + maintainers = [ maintainers.fufexan ]; + }; +} diff --git a/pkgs/data/themes/catppuccin-gtk/grey-fix.patch b/pkgs/data/themes/catppuccin-gtk/grey-fix.patch new file mode 100644 index 00000000000..73f7d8fa65d --- /dev/null +++ b/pkgs/data/themes/catppuccin-gtk/grey-fix.patch @@ -0,0 +1,12 @@ +diff --git a/scripts/install.sh b/scripts/install.sh +index d2a2b86..bd05c93 100755 +--- a/scripts/install.sh ++++ b/scripts/install.sh +@@ -20,7 +20,7 @@ fi + SASSC_OPT="-M -t expanded" + + THEME_NAME=Catppuccin +-THEME_VARIANTS=('' '-purple' '-pink' '-red' '-orange' '-yellow' '-green' '-teal' '-grey') ++THEME_VARIANTS=('' '-purple' '-pink' '-red' '-orange' '-yellow' '-green' '-teal') + COLOR_VARIANTS=('' '-light' '-dark') + SIZE_VARIANTS=('' '-compact') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 95e5bec551a..a7d90d084ca 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -294,6 +294,8 @@ with pkgs; catatonit = callPackage ../applications/virtualization/catatonit { }; + catppuccin-gtk = callPackage ../data/themes/catppuccin-gtk { }; + btdu = callPackage ../tools/misc/btdu { }; cereal = callPackage ../development/libraries/cereal { };