add lotte-art

This commit is contained in:
Charlotte 🦝 Delenk 2022-09-25 15:46:19 +01:00
parent b89c139750
commit ef3394a6c8
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
17 changed files with 95 additions and 79 deletions

View file

@ -1,3 +0,0 @@
{pkgs, ...}: {
lotte-art = pkgs.callPackage ./source.nix {};
}

View file

@ -1,4 +1,5 @@
{ callPackage }: callPackage ../../../lib/mkPleromaEmoji.nix {} rec {
{callPackage}:
callPackage ../../../lib/mkPleromaEmoji.nix {} rec {
name = "blobfox";
manifest = ./${name}.json;
passthru.updateScript = [

View file

@ -1,4 +1,5 @@
{ callPackage }: callPackage ../../../lib/mkPleromaEmoji.nix {} rec {
{callPackage}:
callPackage ../../../lib/mkPleromaEmoji.nix {} rec {
name = "blobfox_flip";
manifest = ./blobfox.json;
}

View file

@ -1,4 +1,5 @@
{ callPackage }: callPackage ../../../lib/mkPleromaEmoji.nix {} rec {
{callPackage}:
callPackage ../../../lib/mkPleromaEmoji.nix {} rec {
name = "bunhd";
manifest = ./${name}.json;
passthru.updateScript = [

View file

@ -1,4 +1,5 @@
{ callPackage }: callPackage ../../../lib/mkPleromaEmoji.nix {} rec {
{callPackage}:
callPackage ../../../lib/mkPleromaEmoji.nix {} rec {
name = "bunhd_flip";
manifest = ./bunhd.json;
}

View file

@ -1,4 +1,5 @@
{ callPackage }: callPackage ../../../lib/mkPleromaEmoji.nix {} rec {
{callPackage}:
callPackage ../../../lib/mkPleromaEmoji.nix {} rec {
name = "drgn";
manifest = ./${name}.json;
passthru.updateScript = [

View file

@ -1,4 +1,5 @@
{ callPackage }: callPackage ../../../lib/mkPleromaEmoji.nix {} rec {
{callPackage}:
callPackage ../../../lib/mkPleromaEmoji.nix {} rec {
name = "fox";
manifest = ./${name}.json;
passthru.updateScript = [

View file

@ -1,4 +1,5 @@
{ callPackage }: callPackage ../../../lib/mkPleromaEmoji.nix {} rec {
{callPackage}:
callPackage ../../../lib/mkPleromaEmoji.nix {} rec {
name = "raccoon";
manifest = ./${name}.json;
passthru.updateScript = [

View file

@ -1,4 +1,5 @@
{ callPackage }: callPackage ../../../lib/mkPleromaEmoji.nix {} rec {
{callPackage}:
callPackage ../../../lib/mkPleromaEmoji.nix {} rec {
name = "vlpn";
manifest = ./${name}.json;
passthru.updateScript = [

22
art/lotte/default.nix Normal file
View file

@ -0,0 +1,22 @@
{ stdenv, fetchgit, lib }: let
src = builtins.fromJSON (builtins.readFile ./source.json);
in stdenv.mkDerivation {
pname = "lotte-art";
version = src.date;
src = fetchgit {
inherit (src) url rev sha256 fetchLFS fetchSubmodules deepClone leaveDotGit;
};
preferLocalBuild = true;
passthru.updateScript = [
../../scripts/update-git.sh
"https://git.chir.rs/darkkirb/lotte-art"
"art/lotte/source.json"
"--fetch-lfs"
];
meta = {
description = "Art I commissioned (mostly)";
license = lib.licenses.cc-by-nc-sa-40;
};
buildPhase = "true";
installPhase = "cp -r $src $out";
}

11
art/lotte/source.json Normal file
View file

@ -0,0 +1,11 @@
{
"url": "https://git.chir.rs/darkkirb/lotte-art",
"rev": "28da5b860c7d604aee5889ede4ee7985b4386ba5",
"date": "2022-08-16T08:46:58+01:00",
"path": "/nix/store/ivwrhckcfijiclwybv57igqw6m0rl7zx-lotte-art",
"sha256": "113wdw922n43q3y6p55mih2nnqsjz2asy7rmz1ak2fgd8pfd7yl1",
"fetchLFS": true,
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false
}

View file

@ -1,7 +0,0 @@
{fetchgit}:
fetchgit {
url = "https://git.chir.rs/darkkirb/lotte-art";
rev = "28da5b860c7d604aee5889ede4ee7985b4386ba5";
sha256 = "113wdw922n43q3y6p55mih2nnqsjz2asy7rmz1ak2fgd8pfd7yl1";
fetchLFS = true;
}

View file

@ -1,27 +0,0 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p nix-prefetch-git jq git git-lfs
WORK_DIR=$(mktemp -d)
URL=https://git.chir.rs/darkkirb/lotte-art
TARGET_DIR="$PWD"
function cleanup {
grep "fatal" $WORK_DIR/nix-prefetch-git.out >/dev/stderr || true
rm -rf "$WORK_DIR"
}
trap cleanup EXIT
echo "Fetching source code $REVISION from $URL"
JSON=$(nix-prefetch-git --url "$URL" --fetch-lfs 2> $WORK_DIR/nix-prefetch-git.out | grep -v " Git" | grep -v "Git ")
REVISION=$(echo "$JSON" | jq -r .rev)
SHA=$(echo "$JSON" | jq -r .sha256)
cat > source.nix << EOF
{fetchgit}:
fetchgit {
url = "$URL";
rev = "$REVISION";
sha256 = "$SHA";
fetchLFS = true;
}
EOF

View file

@ -22,4 +22,5 @@
emoji-volpeon-fox = pkgs.callPackage ./art/emoji/volpeon/fox.nix {};
emoji-volpeon-raccoon = pkgs.callPackage ./art/emoji/volpeon/raccoon.nix {};
emoji-volpeon-vlpn = pkgs.callPackage ./art/emoji/volpeon/vlpn.nix {};
lotte-art = pkgs.callPackage ./art/lotte {};
}

View file

@ -1,3 +1,3 @@
{ pkgs, ...}: {
{pkgs, ...}: {
mkPleromaEmoji = pkgs.callPackage ./mkPleromaEmoji.nix {};
}

View file

@ -1,33 +1,44 @@
{ 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;
};
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;
{
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;
};
} // args)
brokenLicenses = {
"CC BY-NC-SA 4.0" = lib.licenses.cc-by-nc-sa-20;
"Apache 2.0" = lib.licenses.asl20;
};
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)

View file

@ -3,4 +3,4 @@
URL=$1
WRITE_PATH=$2
nix-prefetch-git $URL > $WRITE_PATH
nix-prefetch-git $3 $URL | grep -v "Git " > $WRITE_PATH