Merge branch 'main' of ssh://git.0x76.dev:42/v/infrastructure
This commit is contained in:
commit
52483f2ea1
7 changed files with 116 additions and 20 deletions
|
@ -21,7 +21,9 @@ in {
|
||||||
helix
|
helix
|
||||||
inputs.attic.packages.${pkgs.system}.attic
|
inputs.attic.packages.${pkgs.system}.attic
|
||||||
inputs.comma.packages.${pkgs.system}.default
|
inputs.comma.packages.${pkgs.system}.default
|
||||||
inputs.webcord.packages.${pkgs.system}.default
|
# inputs.webcord.packages.${pkgs.system}.default
|
||||||
|
discord
|
||||||
|
dogdns
|
||||||
jetbrains.clion
|
jetbrains.clion
|
||||||
jetbrains.rust-rover
|
jetbrains.rust-rover
|
||||||
kdenlive
|
kdenlive
|
||||||
|
|
15
nixos/pkgs/glitch-soc/README.md
Normal file
15
nixos/pkgs/glitch-soc/README.md
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
# Mastodon Glitch Edition
|
||||||
|
|
||||||
|
Mostly copied from [nixpkgs upstream](https://github.com/NixOS/nixpkgs/tree/master/pkgs/servers/mastodon).
|
||||||
|
|
||||||
|
Modifications for the new yarn berry lockfiles in `default.nix`, `yarn.nix` and `yarn-typescript.patch` stolen (with permissions) from [catgirl.cloud](https://git.catgirl.cloud/999eagle/dotfiles-nix/-/tree/main/overlay/mastodon/glitch).
|
||||||
|
|
||||||
|
See also: https://github.com/NixOS/nixpkgs/issues/277697
|
||||||
|
|
||||||
|
Update:
|
||||||
|
|
||||||
|
```
|
||||||
|
./update.sh --owner glitch-soc --repo mastodon --patches "./yarn-typescript.patch" --rev $COMMIT
|
||||||
|
```
|
||||||
|
|
||||||
|
The yarn hash isn't updated automatically due to the lockfile thing, run a build and copy the hash from the error message to source.nix by hand.
|
|
@ -1,6 +1,15 @@
|
||||||
|
/*
|
||||||
|
Copied from nixpkgs upstream:
|
||||||
|
https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/servers/mastodon/default.nix
|
||||||
|
|
||||||
|
Modifications for new yarn lockfiles stolen (with permission) from:
|
||||||
|
https://git.catgirl.cloud/999eagle/dotfiles-nix/-/blob/main/overlay/mastodon/glitch/yarn.nix
|
||||||
|
*/
|
||||||
|
|
||||||
{ lib, stdenv, nodejs-slim, bundlerEnv, nixosTests
|
{ lib, stdenv, nodejs-slim, bundlerEnv, nixosTests
|
||||||
, yarn, callPackage, ruby, writeShellScript
|
, yarn, callPackage, ruby, writeShellScript
|
||||||
, fetchYarnDeps, prefetch-yarn-deps
|
, fetchYarnDeps, prefetch-yarn-deps
|
||||||
|
, yarn-berry, callPackage, imagemagick, ffmpeg, file, ruby, writeShellScript
|
||||||
, brotli
|
, brotli
|
||||||
|
|
||||||
# Allow building a fork or custom version of Mastodon:
|
# Allow building a fork or custom version of Mastodon:
|
||||||
|
@ -28,12 +37,13 @@ stdenv.mkDerivation rec {
|
||||||
pname = "${pname}-modules";
|
pname = "${pname}-modules";
|
||||||
inherit src version;
|
inherit src version;
|
||||||
|
|
||||||
yarnOfflineCache = fetchYarnDeps {
|
# use the fixed yarn berry offline cache thingy
|
||||||
yarnLock = "${src}/yarn.lock";
|
yarnOfflineCache = callPackage ./yarn.nix {
|
||||||
|
inherit src;
|
||||||
hash = yarnHash;
|
hash = yarnHash;
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ prefetch-yarn-deps nodejs-slim yarn mastodonGems mastodonGems.wrappedRuby brotli ];
|
nativeBuildInputs = [ nodejs-slim yarn-berry mastodonGems mastodonGems.wrappedRuby brotli ];
|
||||||
|
|
||||||
RAILS_ENV = "production";
|
RAILS_ENV = "production";
|
||||||
NODE_ENV = "production";
|
NODE_ENV = "production";
|
||||||
|
@ -45,9 +55,12 @@ stdenv.mkDerivation rec {
|
||||||
# This option is needed for openssl-3 compatibility
|
# This option is needed for openssl-3 compatibility
|
||||||
# Otherwise we encounter this upstream issue: https://github.com/mastodon/mastodon/issues/17924
|
# Otherwise we encounter this upstream issue: https://github.com/mastodon/mastodon/issues/17924
|
||||||
export NODE_OPTIONS=--openssl-legacy-provider
|
export NODE_OPTIONS=--openssl-legacy-provider
|
||||||
fixup-yarn-lock ~/yarn.lock
|
|
||||||
yarn config --offline set yarn-offline-mirror $yarnOfflineCache
|
export YARN_ENABLE_TELEMETRY=0
|
||||||
yarn install --offline --frozen-lockfile --ignore-engines --ignore-scripts --no-progress
|
mkdir -p ~/.yarn/berry
|
||||||
|
ln -sf $yarnOfflineCache ~/.yarn/berry/cache
|
||||||
|
|
||||||
|
yarn install --immutable --immutable-cache
|
||||||
|
|
||||||
patchShebangs ~/bin
|
patchShebangs ~/bin
|
||||||
patchShebangs ~/node_modules
|
patchShebangs ~/node_modules
|
||||||
|
@ -57,7 +70,7 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder \
|
OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder \
|
||||||
rails assets:precompile
|
rails assets:precompile
|
||||||
yarn cache clean --offline
|
yarn cache clean
|
||||||
rm -rf ~/node_modules/.cache
|
rm -rf ~/node_modules/.cache
|
||||||
|
|
||||||
# Create missing static gzip and brotli files
|
# Create missing static gzip and brotli files
|
||||||
|
|
|
@ -1,13 +1,19 @@
|
||||||
# This file was generated by pkgs.mastodon.updateScript.
|
# This file was generated by pkgs.mastodon.updateScript.
|
||||||
{ fetchFromGitHub, applyPatches, patches ? [] }:
|
{ fetchFromGitHub, applyPatches, patches ? [] }:
|
||||||
let
|
let
|
||||||
|
<<<<<<< HEAD
|
||||||
version = "bc39b3196db8c79719c5a6c920c780284b8266a";
|
version = "bc39b3196db8c79719c5a6c920c780284b8266a";
|
||||||
|
=======
|
||||||
|
version = "5bc39b3";
|
||||||
|
revision = "5bc39b3196db8c79719c5a6c920c780284b8266a";
|
||||||
|
>>>>>>> 8ec4a162da27435bf9deb68fa41bbfaf0c7d3f49
|
||||||
in
|
in
|
||||||
(
|
(
|
||||||
applyPatches {
|
applyPatches {
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "glitch-soc";
|
owner = "glitch-soc";
|
||||||
repo = "mastodon";
|
repo = "mastodon";
|
||||||
|
<<<<<<< HEAD
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
hash = "sha256-6ipYkF0PP3D15PD7vyN1cGqnxoBRrXEaRsrto7ZXej0=";
|
hash = "sha256-6ipYkF0PP3D15PD7vyN1cGqnxoBRrXEaRsrto7ZXej0=";
|
||||||
};
|
};
|
||||||
|
@ -15,4 +21,13 @@ in
|
||||||
}) // {
|
}) // {
|
||||||
inherit version;
|
inherit version;
|
||||||
yarnHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
yarnHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
||||||
|
=======
|
||||||
|
rev = "${revision}";
|
||||||
|
hash = "sha256-6ipYkF0PP3D15PD7vyN1cGqnxoBRrXEaRsrto7ZXej0=";
|
||||||
|
};
|
||||||
|
patches = patches ++ [./yarn-typescript.patch];
|
||||||
|
}) // {
|
||||||
|
inherit version;
|
||||||
|
yarnHash = "sha256-CIIz5wwWzvDKc/VbSIT7Z5D9kwOLoErXoO0WQWfV/g4=";
|
||||||
|
>>>>>>> 8ec4a162da27435bf9deb68fa41bbfaf0c7d3f49
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#!/usr/bin/env nix-shell
|
#!/usr/bin/env -S nix shell nixpkgs#bundix nixpkgs#coreutils nixpkgs#diffutils nixpkgs#nix-prefetch-git nixpkgs#nix-prefetch-github nixpkgs#gnused nixpkgs#jq nixpkgs#prefetch-yarn-deps -c bash
|
||||||
#! nix-shell -i bash -p bundix coreutils diffutils nix-prefetch-github gnused jq prefetch-yarn-deps
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
OWNER=mastodon
|
OWNER=mastodon
|
||||||
|
@ -51,11 +50,7 @@ if [[ -n "$POSITIONAL" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$REVISION" ]]; then
|
VERSION="${REVISION:0:7}"
|
||||||
REVISION="$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} -s "https://api.github.com/repos/$OWNER/$REPO/releases" | jq -r 'map(select(.prerelease == false)) | .[0].tag_name')"
|
|
||||||
fi
|
|
||||||
|
|
||||||
VERSION="$(echo "$REVISION" | cut -c2-)"
|
|
||||||
|
|
||||||
rm -f gemset.nix source.nix
|
rm -f gemset.nix source.nix
|
||||||
cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1
|
cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1
|
||||||
|
@ -85,13 +80,14 @@ cat > source.nix << EOF
|
||||||
{ fetchFromGitHub, applyPatches, patches ? [] }:
|
{ fetchFromGitHub, applyPatches, patches ? [] }:
|
||||||
let
|
let
|
||||||
version = "$VERSION";
|
version = "$VERSION";
|
||||||
|
revision = "$REVISION";
|
||||||
in
|
in
|
||||||
(
|
(
|
||||||
applyPatches {
|
applyPatches {
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "$OWNER";
|
owner = "$OWNER";
|
||||||
repo = "$REPO";
|
repo = "$REPO";
|
||||||
rev = "v\${version}";
|
rev = "\${revision}";
|
||||||
hash = "$HASH";
|
hash = "$HASH";
|
||||||
};
|
};
|
||||||
patches = patches ++ [$PATCHES];
|
patches = patches ++ [$PATCHES];
|
||||||
|
@ -106,7 +102,7 @@ echo "Creating gemset.nix"
|
||||||
bundix --lockfile="$SOURCE_DIR/Gemfile.lock" --gemfile="$SOURCE_DIR/Gemfile"
|
bundix --lockfile="$SOURCE_DIR/Gemfile.lock" --gemfile="$SOURCE_DIR/Gemfile"
|
||||||
echo "" >> gemset.nix # Create trailing newline to please EditorConfig checks
|
echo "" >> gemset.nix # Create trailing newline to please EditorConfig checks
|
||||||
|
|
||||||
echo "Creating yarn-hash.nix"
|
# echo "Creating yarn-hash.nix"
|
||||||
YARN_HASH="$(prefetch-yarn-deps "$SOURCE_DIR/yarn.lock")"
|
# YARN_HASH="$(prefetch-yarn-deps "$SOURCE_DIR/yarn.lock")"
|
||||||
YARN_HASH="$(nix hash to-sri --type sha256 "$YARN_HASH")"
|
# YARN_HASH="$(nix hash to-sri --type sha256 "$YARN_HASH")"
|
||||||
sed -i "s/sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=/$YARN_HASH/g" source.nix
|
# sed -i "s/sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=/$YARN_HASH/g" source.nix
|
||||||
|
|
15
nixos/pkgs/glitch-soc/yarn-typescript.patch
Normal file
15
nixos/pkgs/glitch-soc/yarn-typescript.patch
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
--- a/yarn.lock
|
||||||
|
+++ b/yarn.lock
|
||||||
|
@@ -16483,11 +16483,11 @@
|
||||||
|
|
||||||
|
"typescript@patch:typescript@npm%3A5#optional!builtin<compat/typescript>, typescript@patch:typescript@npm%3A^5.0.4#optional!builtin<compat/typescript>":
|
||||||
|
version: 5.3.3
|
||||||
|
- resolution: "typescript@patch:typescript@npm%3A5.3.3#optional!builtin<compat/typescript>::version=5.3.3&hash=e012d7"
|
||||||
|
+ resolution: "typescript@patch:typescript@npm%3A5.3.3#optional!builtin<compat/typescript>::version=5.3.3&hash=29ae49"
|
||||||
|
bin:
|
||||||
|
tsc: bin/tsc
|
||||||
|
tsserver: bin/tsserver
|
||||||
|
- checksum: 1d0a5f4ce496c42caa9a30e659c467c5686eae15d54b027ee7866744952547f1be1262f2d40de911618c242b510029d51d43ff605dba8fb740ec85ca2d3f9500
|
||||||
|
+ checksum: e22df47df9b2b2f2617b8bf511a29aea3d177f9f7a0756818230a76b01cbd7da988bf55f9463aaa1a4c1ff90b80f8dc5676460d4e9dfc010572cbba59b822b0c
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
40
nixos/pkgs/glitch-soc/yarn.nix
Normal file
40
nixos/pkgs/glitch-soc/yarn.nix
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
Stolen (with permission) from:
|
||||||
|
https://git.catgirl.cloud/999eagle/dotfiles-nix/-/blob/main/overlay/mastodon/glitch/yarn.nix
|
||||||
|
*/
|
||||||
|
|
||||||
|
{
|
||||||
|
stdenvNoCC,
|
||||||
|
yarn-berry,
|
||||||
|
cacert,
|
||||||
|
src,
|
||||||
|
hash,
|
||||||
|
}:
|
||||||
|
stdenvNoCC.mkDerivation {
|
||||||
|
name = "yarn-deps";
|
||||||
|
nativeBuildInputs = [yarn-berry cacert];
|
||||||
|
inherit src;
|
||||||
|
|
||||||
|
dontInstall = true;
|
||||||
|
|
||||||
|
NODE_EXTRA_CA_CERTS = "${cacert}/etc/ssl/certs/ca-bundle.crt";
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
mkdir -p $out
|
||||||
|
|
||||||
|
export HOME=$(mktemp -d)
|
||||||
|
echo $HOME
|
||||||
|
|
||||||
|
export YARN_ENABLE_TELEMETRY=0
|
||||||
|
export YARN_COMPRESSION_LEVEL=0
|
||||||
|
|
||||||
|
cache="$(yarn config get cacheFolder)"
|
||||||
|
yarn install --immutable --mode skip-build
|
||||||
|
|
||||||
|
cp -r $cache/* $out/
|
||||||
|
'';
|
||||||
|
|
||||||
|
outputHashAlgo = "sha256";
|
||||||
|
outputHash = hash;
|
||||||
|
outputHashMode = "recursive";
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue