add web folder

This commit is contained in:
Charlotte 🦝 Delenk 2022-09-30 16:09:55 +01:00
parent a3997a63b7
commit 926e72a1f2
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
6 changed files with 42 additions and 57 deletions

View file

@ -49,5 +49,6 @@
plover-plugin-machine-hid = pkgs.python3Packages.callPackage ./plover/plover-machine-hid.nix {};
plover-plugin-rkb1-hid = pkgs.python3Packages.callPackage ./plover/plover-rkb1-hid.nix {};
plover-dict-didoesdigital = pkgs.callPackage ./plover/didoesdigital-dictionary.nix {};
clean-s3-cache = pkgs.python3Packages.callPackage ./scripts/clean-s3-cache.nix {};
miifox-net = pkgs.python3Packages.callPackage ./web/miifox-net.nix {};
old-homepage = pkgs.callPackage ./web/old-homepage.nix {};
}

View file

@ -1,25 +1,34 @@
{
inputs,
pkgs,
...
}: rec {
miifox-net-source = pkgs.callPackage ./miifox-source.nix {};
miifox-net = pkgs.stdenvNoCC.mkDerivation {
stdenvNoCC,
fetchFromGitea,
chevron,
lndir,
lib,
}: let
source = builtins.fromJSON (builtins.readFile ./miifox.json);
in
stdenvNoCC.mkDerivation {
pname = "miifox.net";
version = inputs.miifox-net.lastModifiedDate;
srcs = miifox-net-source;
nativeBuildInputs = with pkgs; [
python3Packages.chevron
xorg.lndir
];
version = source.date;
src = fetchFromGitea {
domain = "git.chir.rs";
owner = "CarolineHusky";
repo = "MiiFox.net";
inherit (source) rev sha256;
};
nativeBuildInputs = [chevron lndir];
buildPhase = ''
chevron -d index.json index.handlebars > index.html
'';
installPhase = ''
mkdir $out
lndir -silent ${inputs.miifox-net} $out
lndir -silent $src $out
cp index.html $out
rm $out/index.json
'';
};
}
meta = {
description = "miifox.net";
license = lib.licenses.unfree;
};
passthru.updateScript = [../scripts/update-git.sh "https://git.chir.rs/CarolineHusky/MiiFox.net" "web/miifox.json"];
}

View file

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

11
web/miifox.json Normal file
View file

@ -0,0 +1,11 @@
{
"url": "https://git.chir.rs/CarolineHusky/MiiFox.net",
"rev": "7826b9a3bec5dddd4b8a879c3396a1406fc37370",
"date": "2022-03-25T14:54:52+01:00",
"path": "/nix/store/cb9yh3x2vsgk8w8zw1w84lf3nkfk4qki-MiiFox.net",
"sha256": "1yhg1b7mbdxrv344zgd7c04izz9b7khlhjr2rvbpcrb30v0qz89q",
"fetchLFS": false,
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false
}

View file

@ -1,7 +1,6 @@
{pkgs, ...}: {
homepage-old = pkgs.fetchzip {
url = "https://static.darkkirb.de/homepage.tar.zst";
sha256 = "sha256-T9fiDZSaAO9+YljPgQM7vEtJcs0tQF2Bd0BlsO4EyfE=";
nativeBuildInputs = [pkgs.zstd];
};
{fetchzip}:
pkgs.fetchzip {
url = "https://static.darkkirb.de/homepage.tar.zst";
sha256 = "sha256-T9fiDZSaAO9+YljPgQM7vEtJcs0tQF2Bd0BlsO4EyfE=";
nativeBuildInputs = [pkgs.zstd];
}

View file

@ -1,28 +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/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