Created
February 10, 2020 06:41
-
-
Save andrew-d/41f2942a32b02249fac2dadf934cecec to your computer and use it in GitHub Desktop.
Completely untested Nix builder for icon theme with only "image-missing.png"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ stdenv | |
, pkgs | |
, gnome3 | |
, hicolor-icon-theme | |
}: | |
stdenv.mkDerivation { | |
pname = "only-missing"; | |
version = "0.0.1"; | |
propagatedBuildInputs = [ hicolor-icon-theme ]; | |
buildInputs = [ gnome3.adwaita-icon-theme ]; | |
builder = pkgs.writeScript "only-missing-builder.sh" '' | |
. ${stdenv}/setup | |
mkdir -p $out/share/icons/only-missing/ | |
declare -a directories | |
for f in "${gnome3.adwaita-icon-theme}/share/icons/Adwaita"/*; do | |
if [[ ! -d "$f" ]]; then | |
continue | |
fi | |
size="''${f##*/}" | |
if [[ -f "$f/legacy/image-missing.png" ]]; then | |
mkdir -p $out/share/icons/only-missing/$size/legacy | |
cp -v "$f/legacy/image-missing.png" $out/share/icons/only-missing/$size/legacy/ | |
directories+=("$size/legacy") | |
fi | |
if [[ -f "$f/status/image-missing.png" ]]; then | |
mkdir -p $out/share/icons/only-missing/$size/status | |
cp -v "$f/status/image-missing.png" $out/share/icons/only-missing/$size/status/ | |
directories+=("$size/status") | |
fi | |
done | |
theme=$out/share/icons/only-missing/index.theme | |
cat <<EOF > $theme | |
[Icon Theme] | |
Name=only-missing | |
Comment=Fallback icon theme with image-missing | |
Hidden=true | |
EOF | |
( export IFS="," ; echo "Directories=''${directories[*]}" ) >> $theme | |
for dir in "''${directories[@]}"; do | |
size="''${dir%%x*}" | |
name="''${dir##*/}" | |
cat <<EOF >> $theme | |
[$dir] | |
Size=$size | |
Context=''${name^} | |
Type=Fixed | |
EOF | |
done | |
''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment