This repository has been archived on 2024-10-13. You can view files and clone it, but cannot push or open issues or pull requests.
nix-packages/lib/mkPleromaEmoji.nix

45 lines
974 B
Nix
Raw Normal View History

2022-09-25 14:46:19 +00:00
{
stdenv,
fetchurl,
oxipng,
lib,
libarchive,
}: {
name,
manifest,
...
} @ args: let
manifestData = (builtins.fromJSON (builtins.readFile manifest)).${name};
src = fetchurl {
url = manifestData.src;
sha256 = manifestData.src_sha256;
};
brokenLicenses = {
"CC BY-NC-SA 4.0" = lib.licenses.cc-by-nc-sa-20;
"Apache 2.0" = lib.licenses.asl20;
2022-09-25 13:54:42 +00:00
};
2022-09-25 14:46:19 +00:00
fixLicense = license: brokenLicenses.${license} or license;
in
stdenv.mkDerivation ({
inherit name src;
nativeBuildInputs = [
oxipng
libarchive
];
unpackPhase = ''
bsdtar -xf $src
'';
buildPhase = ''
find . -type f -name '*.png' -execdir oxipng -o max -t $NIX_BUILD_CORES {} \;
'';
installPhase = ''
mkdir $out
cp -r * $out
'';
meta = with lib; {
inherit (manifestData) description homepage;
license = fixLicense manifestData.license;
};
}
// args)