update script

This commit is contained in:
ash lea 2022-05-24 12:29:22 -04:00
parent 846080b82e
commit 242682c015
7 changed files with 48 additions and 17 deletions

View File

@ -5,7 +5,7 @@ let
version = import ./mastodon/version.nix;
srcOverride = pkgs.callPackage ./mastodon/source.nix {};
dependenciesDir = ./mastodon;
yarnSha256 = "sha256-tcr/k5Hrg+VY0SVsOyqAXdgyuiJhto3Wy7XICaoQ29E=";
yarnSha256 = import ./mastodon/yarn-sha256.nix;
};
in
{
@ -37,7 +37,7 @@ in
AWS_SECRET_ACCESS_KEY = "/var/lib/mastodon/secrets/aws-secret-access-key";
};
};
postgresqlBackup = {
enable = true;
databases = [ "mastodon" ];
@ -61,7 +61,7 @@ in
"vapid-public-key"
"aws-secret-access-key"
]);
networking.firewall.allowedTCPPorts = [ 80 443 ];
security.acme = {

View File

@ -885,10 +885,10 @@
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1694ndj701a8q4c4bwxz53kx94ih1rr4pgr4gk7a6c8k4jsbjgwi";
sha256 = "025lapimxw0db74gf2yd6zypqq1yvfblhk7wkd6h3r1szk7k8r8p";
type = "gem";
};
version = "2.20.0";
version = "2.21.0";
};
faraday = {
dependencies = ["faraday-em_http" "faraday-em_synchrony" "faraday-excon" "faraday-httpclient" "faraday-multipart" "faraday-net_http" "faraday-net_http_persistent" "faraday-patron" "faraday-rack" "faraday-retry" "ruby2_keywords"];
@ -2464,10 +2464,10 @@
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0xxkghaph53200mfria115swdq6j7p5ssc6gqr1xwvnqiw8g96qd";
sha256 = "0k2wp9sxqpdyc12kp8qafls0yn44vq90zxd830s7y7rxp9xq3018";
type = "gem";
};
version = "1.28.2";
version = "1.29.1";
};
rubocop-ast = {
dependencies = ["parser"];
@ -2475,10 +2475,10 @@
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1k9izkr5rhw3zc309yjp17z7496l74j4li3zrcgpgqfnqwz695qx";
sha256 = "1b3p4wy68jkyq8vhm5y568wlhsihy3ilnp2c6ig18xcw1slnkypl";
type = "gem";
};
version = "1.17.0";
version = "1.18.0";
};
rubocop-rails = {
dependencies = ["activesupport" "rack" "rubocop"];
@ -2592,10 +2592,10 @@
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0fq3nxpj1c9s2bi056p9cldb7zy45bgdkjq8721zypw1pkvllb7f";
sha256 = "0b06kw7frd8hrb7373pvfd39qap00ykkvipgymgwxfjzrgz0ag0d";
type = "gem";
};
version = "6.4.1";
version = "6.4.2";
};
sidekiq-bulk = {
dependencies = ["sidekiq"];

View File

@ -1,9 +1,9 @@
# This file was generated by pkgs.mastodon.updateScript.
{ fetchgit, applyPatches }: let
src = fetchgit {
url = "https://github.com/glitch-soc/mastodon.git";
rev = "06de3a17f89e0a781389354aea6a9e3f72316b7d";
sha256 = "1p5fxswjwdycqwr6njzqn4klswsypq7vlknb146hfnbg1n9dn01h";
url = "https://gitlab.com/tootcat/glitch.git";
rev = "74a78dd413d61272a1fa6a7e7bea27aeb7cd18d2";
sha256 = "10n70yn0n7ilv4js1y4a8wl9ddpwmmii34s4ih8c38kdbsv25iv6";
};
in applyPatches {
inherit src;

View File

@ -1 +1 @@
"3.5.2"
"3.5.2+glitch"

1
mastodon/yarn-sha256.nix Normal file
View File

@ -0,0 +1 @@
"0p2i5ay3ljp9v9qg92s7swyxbxws14zp4yxdhywnwp88d9mpf7yg"

View File

@ -1,10 +1,9 @@
{ pkgs ? import <nixpkgs> {} }:
{ pkgs }:
with pkgs; mkShell {
name = "tootcat-shell";
buildInputs = [
colmena
git-crypt
mastodon.updateScript
];
}

31
update.sh Executable file
View File

@ -0,0 +1,31 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p nix-prefetch-git jq ruby mastodon.updateScript prefetch-yarn-deps
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail
IFS=$'\n\t'
# self-explanatory
UPDATE_URL="https://gitlab.com/tootcat/glitch.git"
nix flake update
# intermediate variables
PREFETCHED_JSON="$(nix-prefetch-git "$UPDATE_URL")"
GIT_REV="$(echo "$PREFETCHED_JSON" | jq -r '.rev')"
REPO_PATH="$(echo "$PREFETCHED_JSON" | jq -r '.path')"
# i believe this is the most "correct" way to get the version string from the source
VERSION="$(ruby -e "require '${REPO_PATH}/lib/mastodon/version.rb'; puts Mastodon::Version.to_s")"
cd mastodon
update.sh --url "$UPDATE_URL" --ver "$VERSION" --rev "$GIT_REV"
# prefetch-yarn-deps outputs everything on stdout so we tee /dev/stderr
# so that we can have human-readable output too and just take the end...
#
# it also writes an extra line at the end so we take the last two lines
#
# this sucks but uh whatever
YARN_SHA256="$(prefetch-yarn-deps -v "${REPO_PATH}/yarn.lock" | tee /dev/stderr | tail -n2)"
# now we write it as a nix string (double quoted) to this file so it can be imported
echo "\"$YARN_SHA256\"" > yarn-sha256.nix