diff --git a/.drone.yml b/.drone.yml index 6a49e65..2049743 100644 --- a/.drone.yml +++ b/.drone.yml @@ -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: diff --git a/web/miifox-net.nix b/web/miifox-net.nix index 8d57389..3d3243e 100644 --- a/web/miifox-net.nix +++ b/web/miifox-net.nix @@ -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 diff --git a/web/miifox-source.nix b/web/miifox-source.nix new file mode 100644 index 0000000..ec26948 --- /dev/null +++ b/web/miifox-source.nix @@ -0,0 +1,7 @@ +{fetchgit}: +fetchgit { + url = "https://git.chir.rs/CarolineHusky/MiiFox.net"; + rev = "7826b9a3bec5dddd4b8a879c3396a1406fc37370"; + sha256 = "1yhg1b7mbdxrv344zgd7c04izz9b7khlhjr2rvbpcrb30v0qz89q"; + fetchLFS = true; +} diff --git a/web/update.sh b/web/update.sh new file mode 100755 index 0000000..a15682e --- /dev/null +++ b/web/update.sh @@ -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