about summary refs log tree commit diff
path: root/pkgs/data
diff options
context:
space:
mode:
authorIvv <41924494+IvarWithoutBones@users.noreply.github.com>2022-05-21 15:22:25 +0200
committerGitHub <noreply@github.com>2022-05-21 15:22:25 +0200
commit36ded0f705079868a5ed91e3f1081adbfcabe548 (patch)
tree3ddb1daddedb81d5bf2f632263bc9e9b039a2095 /pkgs/data
parentd0c7af7c98374faa5cb1e4cb7f174ed1676cd115 (diff)
parent6bece8c8004cf9a3cd7f814bb70fa182adcdbc11 (diff)
Merge pull request #173050 from fufexan/catppuccin-gtk
catppuccin-gtk: init at unstable-2022-02-24
Diffstat (limited to 'pkgs/data')
-rw-r--r--pkgs/data/themes/catppuccin-gtk/default.nix87
-rw-r--r--pkgs/data/themes/catppuccin-gtk/grey-fix.patch12
2 files changed, 99 insertions, 0 deletions
diff --git a/pkgs/data/themes/catppuccin-gtk/default.nix b/pkgs/data/themes/catppuccin-gtk/default.nix
new file mode 100644
index 0000000000000..ec8c931002404
--- /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 0000000000000..73f7d8fa65d34
--- /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')