prepare miifox-net for lfs

This commit is contained in:
Charlotte 🦝 Delenk 2022-07-08 13:13:33 +01:00
parent 46032395d7
commit 02bd202b37
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
4 changed files with 47 additions and 2 deletions

View file

@ -57,6 +57,14 @@ steps:
- (cd python && bash ./update.sh)
depends_on:
- Update flake
- name: Update miifox
image: nixery.dev/shell/nix-prefetch-git/jq/gnugrep
commands:
- (cd web && bash ./update.sh)
environment:
USER: nobody
depends_on:
- Update flake
- name: Format nix
image: nixery.dev/shell/alejandra
commands:
@ -68,6 +76,7 @@ steps:
- Update mautrix-whatsapp
- Update art
- Update pypi
- Update miifox
- name: Push git
image: nixery.dev/shell/gitfull/git-lfs/shadow
commands:

View file

@ -2,11 +2,12 @@
inputs,
pkgs,
...
}: {
}: rec {
miifox-net-source = pkgs.callPackage ./miifox-source.nix {};
miifox-net = pkgs.stdenvNoCC.mkDerivation {
pname = "miifox.net";
version = inputs.miifox-net.lastModifiedDate;
srcs = inputs.miifox-net;
srcs = miifox-net-source;
nativeBuildInputs = with pkgs; [
python3Packages.chevron
xorg.lndir

7
web/miifox-source.nix Normal file
View file

@ -0,0 +1,7 @@
{fetchgit}:
fetchgit {
url = "https://git.chir.rs/CarolineHusky/MiiFox.net";
rev = "7826b9a3bec5dddd4b8a879c3396a1406fc37370";
sha256 = "1yhg1b7mbdxrv344zgd7c04izz9b7khlhjr2rvbpcrb30v0qz89q";
fetchLFS = true;
}

28
web/update.sh Executable file
View file

@ -0,0 +1,28 @@
#!/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/CarolineHusky/MiiFox.net
REVISION=$(jq -r '.nodes."miifox-net".locked.rev' ../flake.lock)
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" --rev "$REVISION" --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 > miifox-source.nix << EOF
{fetchgit}:
fetchgit {
url = "$URL";
rev = "$REVISION";
sha256 = "$SHA";
fetchLFS = true;
}
EOF