add emoji

This commit is contained in:
Charlotte 🦝 Delenk 2022-11-08 21:11:11 +01:00
parent 3499c62077
commit 2692680958
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
5 changed files with 129 additions and 0 deletions

View file

@ -0,0 +1,95 @@
{
callPackage,
stdenvNoCC,
libjxl,
imagemagick,
}: let
crushpng = callPackage ../../../lib/crushpng.nix {};
lotte-art = callPackage ../../lotte {};
resized = name:
stdenvNoCC.mkDerivation {
inherit name;
src = lotte-art;
nativeBuildInputs = [libjxl imagemagick];
buildPhase = ''
djxl $name.jxl $name.png
convert $name.png -scale 128x1:28\> $name-scaled.png
'';
installPhase = ''
cp $name-scaled.png $out
'';
};
lnEmojiScript = name: ''
ln -s ${crushpng {
inherit name;
src = resized name;
maxsize = 40000;
}} $out/${name}.png
'';
emoji = [
"2019-10-05-dae-lotteheart"
"2019-10-05-dae-lottehearts"
"2019-10-05-dae-lottepet"
"2019-11-17-workerq-lottetrash"
"2020-01-05-dae-lotteweary"
"2020-01-17-workerq-lotteblep"
"2020-01-17-workerq-lottecoffee"
"2020-01-17-workerq-lottecookie"
"2020-01-17-workerq-lottehug"
"2020-01-17-workerq-lottesmile"
"2021-03-23-sammythetanuki-lottegoodsalt"
"2021-04-21-sammythetanuki-lottecoffeemachine"
"2021-05-03-sammythetanuki-lotteflatfuck"
"2021-05-03-sammythetanuki-lottehug"
"2021-05-03-sammythetanuki-lottesnuggle"
"2021-05-03-sammythetanuki-lottetrash"
"2021-05-29-sammythetanuki-lottepizza"
"2021-07-02-sammythetanuki-lottegrab"
"2021-07-16-sammythetanuki-lottecarostacc"
"2021-08-03-sammythetanuki-everyonesproblem"
"2021-09-13-sammythetanuki-plushhug"
"2021-10-28-pulexart-me-climbTree"
"2021-10-28-pulexart-me-dab"
"2021-10-28-pulexart-me-eatingPopcorn"
"2021-10-28-pulexart-me-flirt"
"2021-10-28-pulexart-me-garbage"
"2021-10-28-pulexart-me-heartAce"
"2021-10-28-pulexart-me-heartAgender"
"2021-10-28-pulexart-me-heartLGBT"
"2021-10-28-pulexart-me-heartNonbinary"
"2021-10-28-pulexart-me-heartNormal"
"2021-10-28-pulexart-me-heartRaccoongender"
"2021-10-28-pulexart-me-heartTrans"
"2021-10-28-pulexart-me-money"
"2021-10-28-pulexart-me-noU"
"2021-10-28-pulexart-me-plotting"
"2021-10-28-pulexart-me-praise"
"2021-10-28-pulexart-me-robber"
"2021-10-28-pulexart-me-sleepy"
"2021-10-28-pulexart-me-sneak"
"2021-10-28-pulexart-me-trash"
"2021-10-28-pulexart-me-washingFood"
"2021-12-18-sammythetanuki-lottecookies"
"2021-12-20-sammythetanuki-lottecrimmus"
"2022-01-08-sammythetanuki-lotteangry"
"2022-01-08-sammythetanuki-lottepleading"
"2022-02-20-sammythetanuki-lottehacking-notext"
"2022-05-05-sammythetanuki-lotteass"
"2022-06-13-sammythetanuki-lotteplushnothoughts"
"2022-07-14-sammythetanuki-maybecringe-transparent"
"2022-11-06-pulexart-me-heartTherian"
];
in
stdenvNoCC.mkDerivation {
name = "lotte-emoji";
dontUnpack = true;
buildPhase = "true";
installPhase = ''
mkdir $out
${toString (map lnEmojiScript emoji)}
'';
meta = {
description = "Stickers and emoji for the fediverse";
license = lib.licenses.cc-by-nc-sa-40;
};
}

View file

@ -14,6 +14,7 @@
akkoma = pkgs.callPackage ./akkoma {};
pleroma-fe = pkgs.callPackage ./akkoma/pleroma-fe {};
admin-fe = pkgs.callPackage ./akkoma/admin-fe {};
emoji-lotte = pkgs.callPackage ./art/emoji/lotte {};
emoji-volpeon-blobfox = pkgs.callPackage ./art/emoji/volpeon/blobfox.nix {};
emoji-volpeon-blobfox-flip = pkgs.callPackage ./art/emoji/volpeon/blobfox_flip.nix {};
emoji-volpeon-bunhd = pkgs.callPackage ./art/emoji/volpeon/bunhd.nix {};

18
lib/crushpng.nix Normal file
View file

@ -0,0 +1,18 @@
{
stdenvNoCC,
oxipng,
pngquant,
}: {
name,
src,
maxsize,
} @ args:
stdenvNoCC.mkDerivation {
dontUnpack = true;
inherit (args) name src maxsize;
nativeBuildInputs = [oxipng pngquant];
buildPhase = ''
${./crushpng.sh} $src $out $maxsize
'';
installPhase = "true";
}

14
lib/crushpng.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/sh
set -ex
oxipng -o 4 --strip safe -Z $1 --out $2
[ "$(wc -c $2 | awk '{print $1}')" -le $3 ] && exit 0
for i in $(seq 100 -1 0); do
cat $1 | pngquant --quality 0-$i - | oxipng -o 4 --strip safe -Z - --out $2
[ "$(wc -c $2 | awk '{print $1}')" -le $3 ] && exit 0
done
rm $2
exit 1

View file

@ -2,4 +2,5 @@
mkPleromaEmoji = pkgs.callPackage ./mkPleromaEmoji.nix {};
gradleDeps = pkgs.callPackage ./gradleDeps.nix {};
opensslLegacyProvider = pkgs.callPackage ./opensslLegacyProvider.nix {};
crushpng = pkgs.callPackage ./crushpng.nix {};
}