mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-21 12:38:41 +03:00
invidious: unstable-2021-11-13 -> unstable-2022-02-25
This commit is contained in:
parent
d697ee65eb
commit
eeacdb911a
@ -1,4 +1,4 @@
|
||||
{ lib, crystal, fetchFromGitHub, librsvg, pkg-config, libxml2, openssl, sqlite, lsquic, nixosTests }:
|
||||
{ lib, crystal, fetchFromGitHub, librsvg, pkg-config, libxml2, openssl, shards, sqlite, lsquic, videojs, nixosTests }:
|
||||
let
|
||||
# When updating, always update the following:
|
||||
# * the git revision
|
||||
@ -8,17 +8,17 @@ let
|
||||
# * shards.nix (by running `crystal2nix` in invidious’ source tree)
|
||||
# * If the lsquic.cr dependency changed: lsquic in lsquic.nix (version, sha256)
|
||||
# * If the lsquic version changed: boringssl' in lsquic.nix (version, sha256)
|
||||
rev = "00904ae3f2ab6a3cf5f96012d36c5672c3aa17b4";
|
||||
rev = "081fd541afc9b2f9b821e0f8f4c66dda0839295c";
|
||||
in
|
||||
crystal.buildCrystalPackage rec {
|
||||
pname = "invidious";
|
||||
version = "unstable-2021-11-13";
|
||||
version = "unstable-2022-02-25";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "iv-org";
|
||||
repo = pname;
|
||||
inherit rev;
|
||||
sha256 = "sha256-DET4jvB5epkpl5/HTORNTWDL4Ck4IsqhdTApJE8t6Tg=";
|
||||
sha256 = "12m1fd8yfs6fqchvf9masr837dcghsg5x2nb8vcpzakzia5qc2kf";
|
||||
};
|
||||
|
||||
postPatch =
|
||||
@ -33,6 +33,8 @@ crystal.buildCrystalPackage rec {
|
||||
assetCommitTemplate = ''{{ "#{`git rev-list HEAD --max-count=1 --abbrev-commit -- assets`.strip}" }}'';
|
||||
in
|
||||
''
|
||||
for d in ${videojs}/*; do ln -s "$d" assets/videojs; done
|
||||
|
||||
# Use the version metadata from the derivation instead of using git at
|
||||
# build-time
|
||||
substituteInPlace src/invidious.cr \
|
||||
@ -48,19 +50,22 @@ crystal.buildCrystalPackage rec {
|
||||
--replace 'File.read("locales/' 'File.read("${placeholder "out"}/share/invidious/locales/'
|
||||
|
||||
# Reference sql initialisation/migration scripts by absolute path
|
||||
substituteInPlace src/invidious/helpers/helpers.cr \
|
||||
substituteInPlace src/invidious/database/base.cr \
|
||||
--replace 'config/sql' '${placeholder "out"}/share/invidious/config/sql'
|
||||
|
||||
substituteInPlace src/invidious/users.cr \
|
||||
substituteInPlace src/invidious/user/captcha.cr \
|
||||
--replace 'Process.run(%(rsvg-convert' 'Process.run(%(${lib.getBin librsvg}/bin/rsvg-convert'
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ pkg-config ];
|
||||
nativeBuildInputs = [ pkg-config shards ];
|
||||
buildInputs = [ libxml2 openssl sqlite ];
|
||||
|
||||
format = "crystal";
|
||||
shardsFile = ./shards.nix;
|
||||
crystalBinaries.invidious.src = "src/invidious.cr";
|
||||
crystalBinaries.invidious = {
|
||||
src = "src/invidious.cr";
|
||||
options = [ "--release" "--progress" "--verbose" "--no-debug" "-Dskip_videojs_download" ];
|
||||
};
|
||||
|
||||
postConfigure = ''
|
||||
# lib includes nix store paths which can’t be patched, so the links have to
|
||||
|
@ -59,10 +59,22 @@
|
||||
rev = "v0.4.1";
|
||||
sha256 = "1l08cydkdidq9yyil1wl240hvk41iycv04jrg6nx5mkvzw4z1bzg";
|
||||
};
|
||||
spectator = {
|
||||
owner = "icy-arctic-fox";
|
||||
repo = "spectator";
|
||||
rev = "v0.10.4";
|
||||
sha256 = "0rcxq2nbslvwrd8m9ajw6dzaw3hagxmkdy9s8p34cgnr4c9dijdq";
|
||||
};
|
||||
sqlite3 = {
|
||||
owner = "crystal-lang";
|
||||
repo = "crystal-sqlite3";
|
||||
rev = "v0.18.0";
|
||||
sha256 = "03nnvpchhq9f9ywsm3pk2rrj4a3figw7xs96zdziwgr5znkz6x93";
|
||||
};
|
||||
ameba = {
|
||||
owner = "crystal-ameba";
|
||||
repo = "ameba";
|
||||
rev = "v0.14.3";
|
||||
sha256 = "1cfr95xi6hsyxw1wlrh571hc775xhwmssk3k14i8b7dgbwfmm5x1";
|
||||
};
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p common-updater-scripts curl crystal2nix jq git gnused nix nix-prefetch-git nix-update
|
||||
#!nix-shell -i bash -p common-updater-scripts curl crystal crystal2nix jq git gnused nix nix-prefetch-git nix-update pkg-config
|
||||
git_url='https://github.com/iv-org/invidious.git'
|
||||
git_branch='master'
|
||||
git_dir='/var/tmp/invidious.git'
|
||||
nix_file="$(dirname "${BASH_SOURCE[0]}")/default.nix"
|
||||
pkg='invidious'
|
||||
|
||||
set -euo pipefail
|
||||
@ -45,17 +44,23 @@ update-source-version "$pkg" \
|
||||
"$new_version" \
|
||||
"$new_sha256" \
|
||||
--rev="$new_rev"
|
||||
git add "$nix_file"
|
||||
commit_msg="$pkg: $old_version -> $new_version"
|
||||
|
||||
cd "${nix_file%/*}"
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||
|
||||
# fetch video.js dependencies
|
||||
info "Running scripts/fetch-player-dependencies.cr..."
|
||||
git -C "$git_dir" reset --hard "$new_rev"
|
||||
(cd "$git_dir" && crystal run scripts/fetch-player-dependencies.cr -- --minified)
|
||||
rm -f "$git_dir/assets/videojs/.gitignore"
|
||||
videojs_new_sha256=$(nix hash-path --type sha256 --base32 "$git_dir/assets/videojs")
|
||||
sed -e "s,\boutputHash = .*,outputHash = \"$videojs_new_sha256\";," -i 'videojs.nix'
|
||||
|
||||
if git -C "$git_dir" diff-tree --quiet "${old_rev}..${new_rev}" -- 'shard.lock'; then
|
||||
info "shard.lock did not change since $old_rev."
|
||||
else
|
||||
info "Updating shards.nix..."
|
||||
git -C "$git_dir" reset --hard "$new_rev"
|
||||
crystal2nix -- "$git_dir/shard.lock" # argv's index seems broken
|
||||
git add 'shards.nix'
|
||||
|
||||
lsquic_old_version=$(nix-instantiate --eval --strict --json -A "${pkg}.lsquic.version" '../../..' | jq -r)
|
||||
lsquic_new_version=$(nix eval --raw -f 'shards.nix' lsquic.rev \
|
||||
@ -72,8 +77,7 @@ else
|
||||
| jq -r .sha256)
|
||||
sed -e "0,/^ *version = .*/ s// version = \"$boringssl_new_version\";/" \
|
||||
-e "0,/^ *sha256 = .*/ s// sha256 = \"$boringssl_new_sha256\";/" \
|
||||
-i lsquic.nix
|
||||
git add 'lsquic.nix'
|
||||
-i 'lsquic.nix'
|
||||
commit_msg="$commit_msg
|
||||
|
||||
lsquic: $lsquic_old_version -> $lsquic_new_version"
|
||||
@ -81,4 +85,4 @@ lsquic: $lsquic_old_version -> $lsquic_new_version"
|
||||
fi
|
||||
fi
|
||||
|
||||
git commit --verbose --message "$commit_msg"
|
||||
git commit --verbose --message "$commit_msg" *.nix
|
||||
|
15
pkgs/servers/invidious/videojs.nix
Normal file
15
pkgs/servers/invidious/videojs.nix
Normal file
@ -0,0 +1,15 @@
|
||||
{ stdenvNoCC, cacert, crystal, openssl, pkg-config, invidious }:
|
||||
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "videojs";
|
||||
|
||||
inherit (invidious) src;
|
||||
|
||||
builder = ./videojs.sh;
|
||||
|
||||
nativeBuildInputs = [ cacert crystal openssl pkg-config ];
|
||||
|
||||
outputHashAlgo = "sha256";
|
||||
outputHashMode = "recursive";
|
||||
outputHash = "0b4vxd29kpvy60yhqm376r1872gds17s6wljqw0zlr16j762k50r";
|
||||
}
|
9
pkgs/servers/invidious/videojs.sh
Normal file
9
pkgs/servers/invidious/videojs.sh
Normal file
@ -0,0 +1,9 @@
|
||||
source $stdenv/setup
|
||||
|
||||
unpackPhase
|
||||
cd source
|
||||
# this helper downloads the videojs files and checks their checksums
|
||||
# against videojs-dependencies.yml so it should be pure
|
||||
crystal run scripts/fetch-player-dependencies.cr -- --minified
|
||||
rm -f assets/videojs/.gitignore
|
||||
mv assets/videojs "$out"
|
@ -6437,6 +6437,8 @@ with pkgs;
|
||||
invidious = callPackage ../servers/invidious {
|
||||
# needs a specific version of lsquic
|
||||
lsquic = callPackage ../servers/invidious/lsquic.nix { };
|
||||
# normally video.js is downloaded at build time
|
||||
videojs = callPackage ../servers/invidious/videojs.nix { };
|
||||
};
|
||||
|
||||
invoice2data = callPackage ../tools/text/invoice2data { };
|
||||
|
Loading…
Reference in New Issue
Block a user