Add matrix-media-repo

This commit is contained in:
Charlotte 🦝 Delenk 2022-06-12 14:06:20 +01:00
parent 58fe9e8965
commit 2c044834ca
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
7 changed files with 3295 additions and 3 deletions

View file

@ -17,9 +17,11 @@ jobs:
- name: Update flake.lockfile
run: nix flake update
- name: Run update script for minecraft
run: ./minecraft/update.sh
run: cd minecraft && ./update.sh
- name: Run update script for mastodon
run: ./mastodon/update.sh
run: cd mastodon && ./update.sh
- name: Run update script for matrix-media-repo
run: cd matrix/matrix-media-repo && ./update.sh
- name: Run nix formatter
run: nix fmt
- name: Commit and push

View file

@ -31,6 +31,25 @@
"type": "github"
}
},
"gomod2nix": {
"inputs": {
"nixpkgs": "nixpkgs",
"utils": "utils"
},
"locked": {
"lastModified": 1654019497,
"narHash": "sha256-yj53tEaOAJoZ1iEBbZ4TArpgAsLZnmivfr4eD0xF52c=",
"owner": "tweag",
"repo": "gomod2nix",
"rev": "71c797eb0d83f33de7e0247b3ffe7120d98c6b49",
"type": "github"
},
"original": {
"owner": "tweag",
"repo": "gomod2nix",
"type": "github"
}
},
"mastodon": {
"flake": false,
"locked": {
@ -47,6 +66,22 @@
"type": "github"
}
},
"matrix-media-repo": {
"flake": false,
"locked": {
"lastModified": 1648768263,
"narHash": "sha256-H1S9l5S4gcVU482qYCpDW+Ki0r8VkwBgkbUCk6k63sg=",
"owner": "turt2live",
"repo": "matrix-media-repo",
"rev": "3184dbc7720fc103aaf4704be894eac69535e887",
"type": "github"
},
"original": {
"owner": "turt2live",
"repo": "matrix-media-repo",
"type": "github"
}
},
"miifox-net": {
"flake": false,
"locked": {
@ -64,6 +99,38 @@
}
},
"nixpkgs": {
"locked": {
"lastModified": 1653581809,
"narHash": "sha256-Uvka0V5MTGbeOfWte25+tfRL3moECDh1VwokWSZUdoY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "83658b28fe638a170a19b8933aa008b30640fbd1",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-go116": {
"locked": {
"lastModified": 1653232931,
"narHash": "sha256-t9cmSEy9HRkQ3kO560qI75sDijkWk1k2U7DFa5C7uNY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "dab5668f6be905a7f0de39a7d67fd8f78a13d600",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "dab5668f6be905a7f0de39a7d67fd8f78a13d600",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1654953433,
"narHash": "sha256-TwEeh4r50NdWHFAHQSyjCk2cZxgwUfcCCAJOhPdXB28=",
@ -82,9 +149,27 @@
"inputs": {
"clean-s3-cache": "clean-s3-cache",
"flake-utils": "flake-utils",
"gomod2nix": "gomod2nix",
"mastodon": "mastodon",
"matrix-media-repo": "matrix-media-repo",
"miifox-net": "miifox-net",
"nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs_2",
"nixpkgs-go116": "nixpkgs-go116"
}
},
"utils": {
"locked": {
"lastModified": 1653893745,
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},

View file

@ -12,6 +12,10 @@
miifox-net.flake = false;
mastodon.url = "github:glitch-soc/mastodon";
mastodon.flake = false;
nixpkgs-go116.url = "github:NixOS/nixpkgs/dab5668f6be905a7f0de39a7d67fd8f78a13d600";
matrix-media-repo.url = "github:turt2live/matrix-media-repo";
matrix-media-repo.flake = false;
gomod2nix.url = "github:tweag/gomod2nix";
};
outputs = {
@ -38,6 +42,7 @@
./web/miifox-net.nix
./minecraft/paper.nix
./mastodon
./matrix/matrix-media-repo
]);
hydraJobs = {

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,28 @@
{inputs, ...} @ args: let
pkgs = import inputs.nixpkgs-go116 {inherit (args.pkgs) system;};
buildGoApplication = pkgs.callPackage "${inputs.gomod2nix}/builder" {};
in {
matrix-media-repo = buildGoApplication rec {
pname = "matrix-media-repo";
version = inputs.matrix-media-repo.lastModifiedDate;
src = inputs.matrix-media-repo;
patches = [
./async-media.patch
];
go = pkgs.go_1_16;
proxyVendor = true;
modules = ./gomod2nix.toml;
nativeBuildInputs = [
pkgs.git
];
buildPhase = ''
GOBIN=$PWD/bin go install -v ./cmd/compile_assets
$PWD/bin/compile_assets
GOBIN=$PWD/bin go install -ldflags "-X github.com/turt2live/matrix-media-repo/common/version.GitCommit=$(git rev-list -1 HEAD) -X github.com/turt2live/matrix-media-repo/common/version.Version=$(git describe --tags)" -v ./cmd/...
'';
installPhase = ''
mkdir $out
cp -rv bin $out
'';
};
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,22 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p nix-prefetch-git jq
set -e
WORK_DIR=$(mktemp -d)
URL=https://github.com/turt2live/matrix-media-repo
REVISION=$(jq -r '.nodes."matrix-media-repo".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" 2> $WORK_DIR/nix-prefetch-git.out)
SHA=$(echo $JSON | jq -r .sha256)
SOURCE_DIR=$(grep '^path is' $WORK_DIR/nix-prefetch-git.out | sed 's/^path is //')
echo "Creating gomod2nix.toml"
nix run github:tweag/gomod2nix -- -dir $SOURCE_DIR -outdir $TARGET_DIR