Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1# shellcheck shell=bash
2
3# Packages often run gtk-update-icon-cache to include their icons in themes’ icon cache.
4# However, since each package is installed to its own prefix, the files will only collide.
5dropIconThemeCache() {
6 if [[ -z "${dontDropIconThemeCache:-}" ]]; then
7 local icondir="${out:?}/share/icons"
8 if [[ -d "${icondir}" ]]; then
9 # 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.
10 find "${icondir}" -name 'icon-theme.cache' -print0 \
11 | while IFS= read -r -d '' file; do
12 echo "Removing ${file}"
13 rm -f "${file}"
14 done
15 fi
16 fi
17}
18
19appendToVar preFixupPhases dropIconThemeCache