gtk{2,3,4}: move to pkgs/by-name

this shouldn't create any rebuilds

I unfortunately had to duplicate the setup hooks, however i think it
is ok because they don't change a lot.
This commit is contained in:
quantenzitrone
2026-01-21 00:52:53 +01:00
parent bd690400ca
commit 23d433a5dc
19 changed files with 68 additions and 6 deletions
@@ -0,0 +1,15 @@
# shellcheck shell=bash
fixupOutputHooks+=(_gtkCleanImmodulesCache)
# Clean comments that link to generator of the file
_gtkCleanImmodulesCache() {
# gtk_module_path is where the modules are installed
# https://gitlab.gnome.org/GNOME/gtk/-/blob/3.24.24/gtk/gtkmodules.c#L68
# gtk_binary_version can be retrived with:
# pkg-config --variable=gtk_binary_version gtk+-3.0
local f="${prefix:?}/lib/@gtk_module_path@/@gtk_binary_version@/immodules.cache"
if [ -f "$f" ]; then
sed 's|Created by .*bin/gtk-query-|Created by bin/gtk-query-|' -i "$f"
fi
}
@@ -0,0 +1,19 @@
# shellcheck shell=bash
# Packages often run gtk-update-icon-cache to include their icons in themes icon cache.
# However, since each package is installed to its own prefix, the files will only collide.
dropIconThemeCache() {
if [[ -z "${dontDropIconThemeCache:-}" ]]; then
local icondir="${out:?}/share/icons"
if [[ -d "${icondir}" ]]; then
# App icons are supposed to go to hicolor theme, since it is a fallback theme as per [icon-theme-spec], but some might still choose to install stylized icons to other themes.
find "${icondir}" -name 'icon-theme.cache' -print0 \
| while IFS= read -r -d '' file; do
echo "Removing ${file}"
rm -f "${file}"
done
fi
fi
}
appendToVar preFixupPhases dropIconThemeCache
@@ -0,0 +1,15 @@
# shellcheck shell=bash
fixupOutputHooks+=(_gtkCleanImmodulesCache)
# Clean comments that link to generator of the file
_gtkCleanImmodulesCache() {
# gtk_module_path is where the modules are installed
# https://gitlab.gnome.org/GNOME/gtk/-/blob/3.24.24/gtk/gtkmodules.c#L68
# gtk_binary_version can be retrived with:
# pkg-config --variable=gtk_binary_version gtk+-3.0
local f="${prefix:?}/lib/@gtk_module_path@/@gtk_binary_version@/immodules.cache"
if [ -f "$f" ]; then
sed 's|Created by .*bin/gtk-query-|Created by bin/gtk-query-|' -i "$f"
fi
}
@@ -0,0 +1,19 @@
# shellcheck shell=bash
# Packages often run gtk-update-icon-cache to include their icons in themes icon cache.
# However, since each package is installed to its own prefix, the files will only collide.
dropIconThemeCache() {
if [[ -z "${dontDropIconThemeCache:-}" ]]; then
local icondir="${out:?}/share/icons"
if [[ -d "${icondir}" ]]; then
# App icons are supposed to go to hicolor theme, since it is a fallback theme as per [icon-theme-spec], but some might still choose to install stylized icons to other themes.
find "${icondir}" -name 'icon-theme.cache' -print0 \
| while IFS= read -r -d '' file; do
echo "Removing ${file}"
rm -f "${file}"
done
fi
fi
}
appendToVar preFixupPhases dropIconThemeCache
-6
View File
@@ -6983,8 +6983,6 @@ with pkgs;
pangomm_2_42 = callPackage ../development/libraries/pangomm/2.42.nix { };
gtk2 = callPackage ../development/libraries/gtk/2.x.nix { };
gtk2-x11 = gtk2.override {
cairo = cairo.override { x11Support = true; };
pango = pango.override {
@@ -6994,10 +6992,6 @@ with pkgs;
gdktarget = "x11";
};
gtk3 = callPackage ../development/libraries/gtk/3.x.nix { };
gtk4 = callPackage ../development/libraries/gtk/4.x.nix { };
# On darwin gtk uses cocoa by default instead of x11.
gtk3-x11 = gtk3.override {
cairo = cairo.override { x11Support = true; };