add matrix-media-repo
This commit is contained in:
parent
68a7d336f3
commit
f94585190a
15 changed files with 70 additions and 19882 deletions
|
@ -30,4 +30,5 @@
|
|||
fairfax-hd = pkgs.callPackage ./fonts/kreative/fairfax-hd.nix {};
|
||||
kreative-square = pkgs.callPackage ./fonts/kreative/kreative-square.nix {};
|
||||
nasin-nanpa = pkgs.callPackage ./fonts/nasin-nanpa {};
|
||||
matrix-media-repo = pkgs.callPackage ./matrix/matrix-media-repo {};
|
||||
}
|
||||
|
|
|
@ -1,24 +1,31 @@
|
|||
{ stdenv, fontforge, fetchFromGitHub, lib, writeScript }:
|
||||
let source = builtins.fromJSON (builtins.readFile ./source.json);
|
||||
{
|
||||
stdenv,
|
||||
fontforge,
|
||||
fetchFromGitHub,
|
||||
lib,
|
||||
writeScript,
|
||||
}: let
|
||||
source = builtins.fromJSON (builtins.readFile ./source.json);
|
||||
version = builtins.fromJSON (builtins.readFile ./version.json);
|
||||
in stdenv.mkDerivation {
|
||||
pname = "nasin-nanpa";
|
||||
version = "${version.minor}";
|
||||
src = fetchFromGitHub {
|
||||
owner = "ETBCOR";
|
||||
repo = "nasin-nanpa";
|
||||
inherit (source) rev sha256;
|
||||
};
|
||||
nativeBuildInputs = [ fontforge ];
|
||||
buildPhase = "fontforge -lang=ff -c 'Open($1); Generate($2)' \"ffversions/${version.major}/nasin-nanpa-${version.minor}.sfd\" \"nasin-nanpa.otf\"";
|
||||
installPhase = "install -m444 -Dt $out/share/fonts/opentype/nasin-nanpa nasin-nanpa.otf";
|
||||
meta = {
|
||||
description = "A font for sitelen pona";
|
||||
license = lib.licenses.mit;
|
||||
};
|
||||
passthru.updateScript = writeScript "update-nasin-nanpa" ''
|
||||
${../../scripts/update-git.sh} https://github.com/ETBCOR/nasin-nanpa fonts/nasin-nanpa/source.json
|
||||
SRC_PATH=$(nix-build -E '(import ./. {}).nasin-nanpa.src')
|
||||
ls $SRC_PATH/ffversions/*/*.sfd | sort | tail -n1 | sed 's|[/-]| |g' | sed 's/.sfd//' | awk '{print "{\"major\": \"" $6 "\", \"minor\": \"" $9 "\"}" }' > fonts/nasin-nanpa/version.json
|
||||
'';
|
||||
}
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "nasin-nanpa";
|
||||
version = "${version.minor}";
|
||||
src = fetchFromGitHub {
|
||||
owner = "ETBCOR";
|
||||
repo = "nasin-nanpa";
|
||||
inherit (source) rev sha256;
|
||||
};
|
||||
nativeBuildInputs = [fontforge];
|
||||
buildPhase = "fontforge -lang=ff -c 'Open($1); Generate($2)' \"ffversions/${version.major}/nasin-nanpa-${version.minor}.sfd\" \"nasin-nanpa.otf\"";
|
||||
installPhase = "install -m444 -Dt $out/share/fonts/opentype/nasin-nanpa nasin-nanpa.otf";
|
||||
meta = {
|
||||
description = "A font for sitelen pona";
|
||||
license = lib.licenses.mit;
|
||||
};
|
||||
passthru.updateScript = writeScript "update-nasin-nanpa" ''
|
||||
${../../scripts/update-git.sh} https://github.com/ETBCOR/nasin-nanpa fonts/nasin-nanpa/source.json
|
||||
SRC_PATH=$(nix-build -E '(import ./. {}).nasin-nanpa.src')
|
||||
ls $SRC_PATH/ffversions/*/*.sfd | sort | tail -n1 | sed 's|[/-]| |g' | sed 's/.sfd//' | awk '{print "{\"major\": \"" $6 "\", \"minor\": \"" $9 "\"}" }' > fonts/nasin-nanpa/version.json
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
pkgs,
|
||||
inputs,
|
||||
}: rec {
|
||||
hydra = inputs.hydra.packages.${pkgs.system}.hydra.overrideAttrs (old: {
|
||||
doCheck = false;
|
||||
});
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
Based on nixos’ mastodon derivation
|
|
@ -1,99 +0,0 @@
|
|||
{
|
||||
inputs,
|
||||
pkgs,
|
||||
} @ args: let
|
||||
pname = "mastodon-glitch";
|
||||
version = inputs.mastodon.lastModifiedDate;
|
||||
src = inputs.mastodon;
|
||||
nasin-nanpa = import ../fonts/nasin-nanpa.nix args;
|
||||
patches = [./toki.patch];
|
||||
in rec {
|
||||
mastodon-yarn = (pkgs.callPackage ./yarn.nix {}).offline_cache;
|
||||
mastodon-gems = pkgs.bundlerEnv {
|
||||
name = "${pname}-gems-${version}";
|
||||
inherit version;
|
||||
ruby = pkgs.ruby_3_0;
|
||||
gemdir = src;
|
||||
gemset = ./gemset.nix;
|
||||
postBuild = ''
|
||||
for gem in "$out"/lib/ruby/gems/*/gems/*; do
|
||||
cp -a "$gem/" "$gem.new"
|
||||
rm "$gem"
|
||||
# needed on macOS, otherwise the mv yields permission denied
|
||||
chmod +w "$gem.new"
|
||||
mv "$gem.new" "$gem"
|
||||
done
|
||||
'';
|
||||
};
|
||||
mastodon-modules = pkgs.stdenv.mkDerivation {
|
||||
pname = "${pname}-modules";
|
||||
inherit src version patches;
|
||||
|
||||
nativeBuildInputs = with pkgs; [fixup_yarn_lock nodejs-slim yarn mastodon-gems mastodon-gems.wrappedRuby];
|
||||
|
||||
RAILS_ENV = "production";
|
||||
NODE_ENV = "production";
|
||||
|
||||
buildPhase = ''
|
||||
export HOME=$PWD
|
||||
fixup_yarn_lock ~/yarn.lock
|
||||
yarn config --offline set yarn-offline-mirror ${mastodon-yarn}
|
||||
yarn install --offline --frozen-lockfile --ignore-engines --ignore-scripts --no-progress
|
||||
|
||||
patchShebangs ~/bin
|
||||
patchShebangs ~/node_modules
|
||||
|
||||
# skip running yarn install
|
||||
rm -rf ~/bin/yarn
|
||||
|
||||
OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder \
|
||||
rails assets:precompile
|
||||
yarn cache clean --offline
|
||||
rm -rf ~/node_modules/.cache
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/public
|
||||
cp -r node_modules $out/node_modules
|
||||
cp -r public/assets $out/public
|
||||
cp -r public/packs $out/public
|
||||
'';
|
||||
};
|
||||
|
||||
mastodon = pkgs.stdenv.mkDerivation rec {
|
||||
inherit pname version src patches;
|
||||
|
||||
propagatedBuildInputs = with pkgs; [imagemagick ffmpeg file mastodon-gems.wrappedRuby];
|
||||
buildInputs = with pkgs; [mastodon-gems nodejs-slim];
|
||||
|
||||
buildPhase = ''
|
||||
ln -s ${mastodon-modules}/node_modules node_modules
|
||||
ln -s ${mastodon-modules}/public/assets public/assets
|
||||
ln -s ${mastodon-modules}/public/packs public/packs
|
||||
|
||||
patchShebangs bin/
|
||||
for b in $(ls ${mastodon-gems}/bin/)
|
||||
do
|
||||
if [ ! -f bin/$b ]; then
|
||||
ln -s ${mastodon-gems}/bin/$b bin/$b
|
||||
fi
|
||||
done
|
||||
|
||||
rm -rf log
|
||||
ln -s /var/log/mastodon log
|
||||
ln -s /tmp tmp
|
||||
'';
|
||||
|
||||
installPhase = let
|
||||
run-streaming = pkgs.writeShellScript "run-streaming.sh" ''
|
||||
# NixOS helper script to consistently use the same NodeJS version the package was built with.
|
||||
${pkgs.nodejs-slim}/bin/node ./streaming
|
||||
'';
|
||||
in ''
|
||||
mkdir -p $out
|
||||
cp -r * $out/
|
||||
ln -s ${nasin-nanpa.nasin-nanpa-woff2} $out/public/nasin-nanpa.woff2
|
||||
ln -s ${run-streaming} $out/run-streaming.sh
|
||||
'';
|
||||
};
|
||||
}
|
3123
mastodon/gemset.nix
3123
mastodon/gemset.nix
File diff suppressed because it is too large
Load diff
3204
mastodon/toki.patch
3204
mastodon/toki.patch
File diff suppressed because it is too large
Load diff
|
@ -1,54 +0,0 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p bundix yarn2nix yarn nix-prefetch-git jq
|
||||
set -e
|
||||
|
||||
URL=$(jq -r '.nodes.mastodon.locked.url' ../flake.lock)
|
||||
REVISION=$(jq -r '.nodes.mastodon.locked.rev' ../flake.lock)
|
||||
|
||||
rm -f gemset.nix yarn.nix
|
||||
TARGET_DIR="$PWD"
|
||||
|
||||
|
||||
WORK_DIR=$(mktemp -d)
|
||||
|
||||
# Check that working directory was created.
|
||||
if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
|
||||
echo "Could not create temporary directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Delete the working directory on exit.
|
||||
function cleanup {
|
||||
# Report errors, if any, from nix-prefetch-git
|
||||
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)
|
||||
FETCHED_SOURCE_DIR=$(grep '^path is' $WORK_DIR/nix-prefetch-git.out | sed 's/^path is //')
|
||||
|
||||
cat > source.nix << EOF
|
||||
# This file was generated by pkgs.mastodon.updateScript.
|
||||
{ fetchgit, applyPatches }: let
|
||||
src = fetchgit {
|
||||
url = "$URL";
|
||||
rev = "$REVISION";
|
||||
sha256 = "$SHA";
|
||||
};
|
||||
in applyPatches {
|
||||
inherit src;
|
||||
patches = [$PATCHES];
|
||||
}
|
||||
EOF
|
||||
SOURCE_DIR="$(nix-build --no-out-link -E '(import <nixpkgs> {}).callPackage ./source.nix {}')"
|
||||
rm source.nix
|
||||
|
||||
echo "Creating gemset.nix"
|
||||
bundix --lockfile="$SOURCE_DIR/Gemfile.lock" --gemfile="$SOURCE_DIR/Gemfile"
|
||||
echo "" >> $TARGET_DIR/gemset.nix # Create trailing newline to please EditorConfig checks
|
||||
|
||||
echo "Creating yarn.nix"
|
||||
yarn2nix --lockfile="$SOURCE_DIR/yarn.lock" > $TARGET_DIR/yarn.nix
|
13307
mastodon/yarn.nix
13307
mastodon/yarn.nix
File diff suppressed because it is too large
Load diff
|
@ -1,15 +1,24 @@
|
|||
{
|
||||
pkgs,
|
||||
inputs,
|
||||
...
|
||||
} @ args: {
|
||||
matrix-media-repo = pkgs.buildGoModule rec {
|
||||
buildGoModule,
|
||||
git,
|
||||
fetchFromGitHub,
|
||||
lib,
|
||||
writeScript,
|
||||
}: let
|
||||
source = builtins.fromJSON (builtins.readFile ./source.json);
|
||||
in
|
||||
buildGoModule rec {
|
||||
pname = "matrix-media-repo";
|
||||
version = inputs.matrix-media-repo.lastModifiedDate;
|
||||
src = pkgs.callPackage ./source.nix {};
|
||||
version = source.date;
|
||||
src = fetchFromGitHub {
|
||||
owner = "turt2live";
|
||||
repo = "matrix-media-repo";
|
||||
inherit (source) rev sha256;
|
||||
};
|
||||
patches = [./async-media.patch];
|
||||
vendorSha256 = builtins.readFile ./vendor.sha256;
|
||||
nativeBuildInputs = [
|
||||
pkgs.git
|
||||
git
|
||||
];
|
||||
proxyVendor = true;
|
||||
CGO_ENABLED = "1";
|
||||
|
@ -22,5 +31,13 @@
|
|||
mkdir $out
|
||||
cp -rv bin $out
|
||||
'';
|
||||
};
|
||||
}
|
||||
meta = {
|
||||
description = "Matrix media repository with multi-domain in mind.";
|
||||
license = lib.licenses.mit;
|
||||
};
|
||||
passthru.updateScript = writeScript "update-matrix-media-repo" ''
|
||||
${../../scripts/update-git.sh} "https://github.com/turt2live/matrix-media-repo" matrix/matrix-media-repo/source.json
|
||||
SRC_PATH=$(nix-build -E '(import ./. {}).${pname}.src')
|
||||
${../../scripts/update-go.sh} ./matrix/matrix-media-repo matrix/matrix-media-repo/vendor.sha256
|
||||
'';
|
||||
}
|
||||
|
|
11
matrix/matrix-media-repo/source.json
Normal file
11
matrix/matrix-media-repo/source.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"url": "https://github.com/turt2live/matrix-media-repo",
|
||||
"rev": "b821ac0a9e2bb152fc3f572e6d502c3266e99ea5",
|
||||
"date": "2022-08-16T22:28:53-06:00",
|
||||
"path": "/nix/store/bnw16n8g8vyq6bv48nwk1z4dj759vn4v-matrix-media-repo",
|
||||
"sha256": "0qg3cf6zm90m810idv7nf4ngb8nb189b3zx4i53qi4d64m7yvfp9",
|
||||
"fetchLFS": false,
|
||||
"fetchSubmodules": false,
|
||||
"deepClone": false,
|
||||
"leaveDotGit": false
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
applyPatches,
|
||||
fetchgit,
|
||||
}:
|
||||
applyPatches {
|
||||
src = fetchgit {
|
||||
url = "https://github.com/turt2live/matrix-media-repo";
|
||||
rev = "b821ac0a9e2bb152fc3f572e6d502c3266e99ea5";
|
||||
sha256 = "0b6s6b6qcal5la5i8z13b6rqizk99j51v5dils7bkjag8zbvhj84";
|
||||
leaveDotGit = true;
|
||||
};
|
||||
patches = [
|
||||
./async-media.patch
|
||||
];
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p nix-prefetch-git nix-prefetch 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" --leave-dotGit 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 //')
|
||||
|
||||
cat > source.nix << EOF
|
||||
{applyPatches, fetchgit}:
|
||||
applyPatches {
|
||||
src = fetchgit {
|
||||
url = "$URL";
|
||||
rev = "$REVISION";
|
||||
sha256 = "$SHA";
|
||||
leaveDotGit = true;
|
||||
};
|
||||
patches = [
|
||||
./async-media.patch
|
||||
];
|
||||
}
|
||||
EOF
|
||||
SOURCE_DIR="$(nix-build --no-out-link -E '(import <nixpkgs> {}).callPackage ./source.nix {}')"
|
||||
|
|
@ -1 +1 @@
|
|||
sha256-VtVovG9LjTnpLkQkeYzMDqqfAWX210uPda3I1TxFv68=
|
||||
sha256-VtVovG9LjTnpLkQkeYzMDqqfAWX210uPda3I1TxFv68=
|
||||
|
|
1
result
1
result
|
@ -1 +0,0 @@
|
|||
/nix/store/dk9hhaxg96669sgl6y9njic1mk8xbz2y-source
|
Reference in a new issue