From 531abe350cb5fccaecb598aa5c63c428167e4f65 Mon Sep 17 00:00:00 2001 From: Sophie Tauchert Date: Mon, 19 Feb 2024 11:52:56 +0100 Subject: invidious: remove dependency on lsquic entirely lsquic hasn't been used in upstream since https://github.com/iv-org/invidious/pull/4008 --- pkgs/servers/invidious/default.nix | 14 +--- pkgs/servers/invidious/lsquic.nix | 133 ----------------------------------- pkgs/servers/invidious/update.sh | 23 ------ pkgs/servers/invidious/versions.json | 8 --- 4 files changed, 1 insertion(+), 177 deletions(-) delete mode 100644 pkgs/servers/invidious/lsquic.nix (limited to 'pkgs/servers') diff --git a/pkgs/servers/invidious/default.nix b/pkgs/servers/invidious/default.nix index 0b1cea5fd689a..42072e266a3aa 100644 --- a/pkgs/servers/invidious/default.nix +++ b/pkgs/servers/invidious/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, crystal, fetchFromGitea, librsvg, pkg-config, libxml2, openssl, shards, sqlite, lsquic, videojs, nixosTests }: +{ lib, stdenv, crystal, fetchFromGitea, librsvg, pkg-config, libxml2, openssl, shards, sqlite, videojs, nixosTests }: let # All versions, revisions, and checksums are stored in ./versions.json. # The update process is the following: @@ -75,20 +75,9 @@ crystal.buildCrystalPackage rec { "--verbose" "--no-debug" "-Dskip_videojs_download" - "-Ddisable_quic" ]; }; - postConfigure = '' - # lib includes nix store paths which can’t be patched, so the links have to - # be dereferenced first. - cp -rL lib lib2 - rm -r lib - mv lib2 lib - chmod +w -R lib - cp ${lsquic}/lib/liblsquic.a lib/lsquic/src/lsquic/ext - ''; - postInstall = '' mkdir -p $out/share/invidious/config @@ -110,7 +99,6 @@ crystal.buildCrystalPackage rec { ''; passthru = { - inherit lsquic; tests = { inherit (nixosTests) invidious; }; updateScript = ./update.sh; }; diff --git a/pkgs/servers/invidious/lsquic.nix b/pkgs/servers/invidious/lsquic.nix deleted file mode 100644 index 9c88ae004aabc..0000000000000 --- a/pkgs/servers/invidious/lsquic.nix +++ /dev/null @@ -1,133 +0,0 @@ -{ lib, boringssl, stdenv, fetchgit, fetchFromGitHub, fetchurl, cmake, zlib, perl, libevent }: -let - versions = lib.importJSON ./versions.json; - - fetchGitilesPatch = { name, url, sha256 }: - fetchurl { - url = "${url}%5E%21?format=TEXT"; - inherit name sha256; - downloadToTemp = true; - postFetch = '' - base64 -d < $downloadedFile > $out - ''; - }; - - # lsquic requires a specific boringssl version (noted in its README) - boringssl' = boringssl.overrideAttrs ({ preBuild, ... }: { - version = versions.boringssl.rev; - src = fetchgit { - url = "https://boringssl.googlesource.com/boringssl"; - inherit (versions.boringssl) rev sha256; - }; - - patches = [ - # Use /etc/ssl/certs/ca-certificates.crt instead of /etc/ssl/cert.pem - ./use-etc-ssl-certs.patch - - # because lsquic requires that specific boringssl version and that - # version does not yet include fixes for gcc11 build errors, they - # must be backported - (fetchGitilesPatch { - name = "fix-mismatch-between-header-and-implementation-of-bn_sqr_comba8.patch"; - url = "https://boringssl.googlesource.com/boringssl/+/139adff9b27eaf0bdaac664ec4c9a7db2fe3f920"; - sha256 = "05sp602dvh50v46jkzmh4sf4wqnq5bwy553596g2rhxg75bailjj"; - }) - (fetchGitilesPatch { - name = "use-an-unsized-helper-for-truncated-SHA-512-variants.patch"; - url = "https://boringssl.googlesource.com/boringssl/+/a24ab549e6ae246b391155d7bed3790ac0e07de2"; - sha256 = "0483jkpg4g64v23ln2blb74xnmzdjcn3r7w4zk7nfg8j3q5f9lxm"; - }) -/* - # the following patch is too complex, so we will modify the build flags - # of crypto/fipsmodule/CMakeFiles/fipsmodule.dir/bcm.c.o in preBuild - # and turn off -Werror=stringop-overflow - (fetchGitilesPatch { - name = "make-md32_common.h-single-included-and-use-an-unsized-helper-for-SHA-256.patch"; - url = "https://boringssl.googlesource.com/boringssl/+/597ffef971dd980b7de5e97a0c9b7ca26eec94bc"; - sha256 = "1y0bkkdf1ccd6crx326agp01q22clm4ai4p982y7r6dkmxmh52qr"; - }) -*/ - (fetchGitilesPatch { - name = "fix-array-parameter-warnings.patch"; - url = "https://boringssl.googlesource.com/boringssl/+/92c6fbfc4c44dc8462d260d836020d2b793e7804"; - sha256 = "0h4sl95i8b0dj0na4ngf50wg54raxyjxl1zzwdc810abglp10vnv"; - }) - ]; - - preBuild = preBuild + lib.optionalString stdenv.isLinux '' - sed -e '/^build crypto\/fipsmodule\/CMakeFiles\/fipsmodule\.dir\/bcm\.c\.o:/,/^ *FLAGS =/ s/^ *FLAGS = -Werror/& -Wno-error=stringop-overflow/' \ - -i build.ninja - '' + lib.optionalString stdenv.cc.isGNU '' - # Silence warning that causes build failures with GCC. - sed -e '/^build ssl\/test\/CMakeFiles\/bssl_shim\.dir\/settings_writer\.cc\.o:/,/^ *FLAGS =/ s/^ *FLAGS = -Werror/& -Wno-error=ignored-attributes/' \ - -e '/^build ssl\/test\/CMakeFiles\/handshaker\.dir\/settings_writer\.cc\.o:/,/^ *FLAGS =/ s/^ *FLAGS = -Werror/& -Wno-error=ignored-attributes/' \ - -i build.ninja - '' + lib.optionalString stdenv.cc.isClang ( - # Silence warnings that cause build failures with newer versions of clang. - let - clangVersion = lib.getVersion stdenv.cc; - in - lib.optionalString (lib.versionAtLeast clangVersion "13") '' - sed -e '/^build crypto\/CMakeFiles\/crypto\.dir\/x509\/t_x509\.c\.o:/,/^ *FLAGS =/ s/^ *FLAGS = -Werror/& -Wno-error=unused-but-set-variable/' \ - -e '/^build tool\/CMakeFiles\/bssl\.dir\/digest\.cc\.o:/,/^ *FLAGS =/ s/^ *FLAGS = -Werror/& -Wno-error=unused-but-set-variable/' \ - -i build.ninja - '' + lib.optionalString (lib.versionAtLeast clangVersion "16") '' - sed -e '/^build crypto\/CMakeFiles\/crypto\.dir\/trust_token\/trust_token\.c\.o:/,/^ *FLAGS =/ s/^ *FLAGS = -Werror/& -Wno-error=single-bit-bitfield-constant-conversion/' \ - -i build.ninja - '' - ); - }); -in -stdenv.mkDerivation rec { - pname = "lsquic"; - version = versions.lsquic.version; - - src = fetchFromGitHub { - owner = "litespeedtech"; - repo = pname; - rev = "v${version}"; - inherit (versions.lsquic) sha256; - fetchSubmodules = true; - }; - - postPatch = '' - substituteInPlace CMakeLists.txt \ - --replace ".so" "${stdenv.hostPlatform.extensions.sharedLibrary}" - ''; - - nativeBuildInputs = [ cmake perl ]; - buildInputs = [ boringssl' libevent zlib ]; - - cmakeFlags = [ - "-DBORINGSSL_DIR=${lib.getDev boringssl'}" - "-DBORINGSSL_LIB_crypto=${lib.getLib boringssl'}/lib/libcrypto.a" - "-DBORINGSSL_LIB_ssl=${lib.getLib boringssl'}/lib/libssl.a" - "-DZLIB_LIB=${zlib}/lib/libz.so" - ]; - - # adapted from lsquic.cr’s Dockerfile - # (https://github.com/iv-org/lsquic.cr/blob/master/docker/Dockerfile) - installPhase = '' - runHook preInstall - - mkdir combinedlib - cd combinedlib - ar -x ${lib.getLib boringssl'}/lib/libssl.a - ar -x ${lib.getLib boringssl'}/lib/libcrypto.a - ar -x ../src/liblsquic/liblsquic.a - ar rc liblsquic.a *.o - ranlib liblsquic.a - install -D liblsquic.a $out/lib/liblsquic.a - - runHook postInstall - ''; - - passthru.boringssl = boringssl'; - - meta = with lib; { - description = "A library for QUIC and HTTP/3 (version for Invidious)"; - homepage = "https://github.com/litespeedtech/lsquic"; - maintainers = with maintainers; [ infinisil sbruder ]; - license = with licenses; [ openssl isc mit bsd3 ]; # statically links against boringssl, so has to include its licenses - }; -} diff --git a/pkgs/servers/invidious/update.sh b/pkgs/servers/invidious/update.sh index d7302e16bfbd4..da5265d31a6c0 100755 --- a/pkgs/servers/invidious/update.sh +++ b/pkgs/servers/invidious/update.sh @@ -68,29 +68,6 @@ if git -C "$git_dir" diff-tree --quiet "${old_rev}..${new_rev}" -- 'shard.lock'; else info "Updating shards.nix..." crystal2nix -- "$git_dir/shard.lock" # argv's index seems broken - - lsquic_old_version=$(json_get '.lsquic.version') - # lsquic.cr's version tracks lsquic's, so lsquic must be updated to the - # version in the shards file - lsquic_new_version=$(nix eval --raw -f 'shards.nix' lsquic.rev \ - | sed -e 's/^v//' -e 's/-[0-9]*$//') - if [ "$lsquic_old_version" != "$lsquic_new_version" ]; then - info "Updating lsquic to $lsquic_new_version..." - json_set '.lsquic.version' "$lsquic_new_version" - lsquic_new_sha256=$(nix-prefetch -I 'nixpkgs=../../..' "${pkg}.lsquic") - json_set '.lsquic.sha256' "$lsquic_new_sha256" - - info "Updating boringssl..." - # lsquic specifies the boringssl commit it requires in its README - boringssl_new_rev=$(curl -LSsf "https://github.com/litespeedtech/lsquic/raw/v${lsquic_new_version}/README.md" \ - | grep -Pom1 '(?<=^git checkout ).*') - json_set '.boringssl.rev' "$boringssl_new_rev" - boringssl_new_sha256=$(nix-prefetch -I 'nixpkgs=../../..' "${pkg}.lsquic.boringssl") - json_set '.boringssl.sha256' "$boringssl_new_sha256" - commit_msg="$commit_msg - -lsquic: $lsquic_old_version -> $lsquic_new_version" - fi fi git commit --verbose --message "$commit_msg" -- versions.json shards.nix diff --git a/pkgs/servers/invidious/versions.json b/pkgs/servers/invidious/versions.json index 73915248c706e..ae01aaa011f3c 100644 --- a/pkgs/servers/invidious/versions.json +++ b/pkgs/servers/invidious/versions.json @@ -1,17 +1,9 @@ { - "boringssl": { - "rev": "251b5169fd44345f455438312ec4e18ae07fd58c", - "sha256": "sha256-EU6T9yQCdOLx98Io8o01rEsgxDFF/Xoy42LgPopD2/A=" - }, "invidious": { "rev": "c005ada48723808e507d0a4d5a3363a1c14a4f07", "sha256": "sha256-KbnBdAAjScwKV4uUzyBXAQx2C7MqCdCM3gSvgNIzKAU=", "version": "unstable-2024-01-29" }, - "lsquic": { - "sha256": "sha256-hG8cUvhbCNeMOsKkaJlgGpzUrIx47E/WhmPIdI5F3qM=", - "version": "2.18.1" - }, "videojs": { "sha256": "0zj8fgxdg6jsllaxn795xipa6yxh4yf08hb8x0idyg74q37gfh4c" } -- cgit 1.4.1 From be6d1e57661c5bceb052642643fc95dc5654d280 Mon Sep 17 00:00:00 2001 From: Sophie Tauchert Date: Mon, 19 Feb 2024 11:57:13 +0100 Subject: invidious: unstable-2024-01-29 -> 0.20.1-unstable-2024-02-18, update update script --- pkgs/servers/invidious/default.nix | 8 ++++-- pkgs/servers/invidious/shards.nix | 54 ++++++++++++------------------------ pkgs/servers/invidious/update.sh | 5 ++-- pkgs/servers/invidious/versions.json | 6 ++-- 4 files changed, 29 insertions(+), 44 deletions(-) (limited to 'pkgs/servers') diff --git a/pkgs/servers/invidious/default.nix b/pkgs/servers/invidious/default.nix index 42072e266a3aa..2913b167a17ad 100644 --- a/pkgs/servers/invidious/default.nix +++ b/pkgs/servers/invidious/default.nix @@ -45,7 +45,7 @@ crystal.buildCrystalPackage rec { substituteInPlace src/invidious.cr \ --replace ${lib.escapeShellArg branchTemplate} '"master"' \ --replace ${lib.escapeShellArg commitTemplate} '"${lib.substring 0 7 versions.invidious.rev}"' \ - --replace ${lib.escapeShellArg versionTemplate} '"${lib.replaceStrings ["-"] ["."] (lib.substring 9 10 version)}"' \ + --replace ${lib.escapeShellArg versionTemplate} '"${lib.concatStringsSep "." (lib.drop 2 (lib.splitString "-" version))}"' \ --replace ${lib.escapeShellArg assetCommitTemplate} '"${lib.substring 0 7 versions.invidious.rev}"' # Patch the assets and locales paths to be absolute @@ -91,11 +91,13 @@ crystal.buildCrystalPackage rec { # environment variable. Even though the database and hmac_key are # bogus, --help still works. installCheckPhase = '' - INVIDIOUS_CONFIG="$(cat < Date: Mon, 19 Feb 2024 13:24:48 +0100 Subject: invidious: use sri hashes in versions.json --- pkgs/servers/invidious/default.nix | 6 +++--- pkgs/servers/invidious/update.sh | 8 ++++---- pkgs/servers/invidious/versions.json | 4 ++-- pkgs/servers/invidious/videojs.nix | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'pkgs/servers') diff --git a/pkgs/servers/invidious/default.nix b/pkgs/servers/invidious/default.nix index 2913b167a17ad..3f5bb42a48f2a 100644 --- a/pkgs/servers/invidious/default.nix +++ b/pkgs/servers/invidious/default.nix @@ -3,9 +3,9 @@ let # All versions, revisions, and checksums are stored in ./versions.json. # The update process is the following: # * pick the latest commit - # * update .invidious.rev, .invidious.version, and .invidious.sha256 + # * update .invidious.rev, .invidious.version, and .invidious.hash # * prefetch the videojs dependencies with scripts/fetch-player-dependencies.cr - # and update .videojs.sha256 (they are normally fetched during build + # and update .videojs.hash (they are normally fetched during build # but nix's sandboxing does not allow that) # * if shard.lock changed # * recreate shards.nix by running crystal2nix @@ -23,7 +23,7 @@ crystal.buildCrystalPackage rec { owner = "iv-org"; repo = pname; fetchSubmodules = true; - inherit (versions.invidious) rev sha256; + inherit (versions.invidious) rev hash; }; postPatch = diff --git a/pkgs/servers/invidious/update.sh b/pkgs/servers/invidious/update.sh index 1c7bf025dd3a4..82c8186bebc48 100755 --- a/pkgs/servers/invidious/update.sh +++ b/pkgs/servers/invidious/update.sh @@ -52,8 +52,8 @@ fi json_set '.invidious.version' "$new_version" json_set '.invidious.rev' "$new_rev" -new_sha256=$(nix-prefetch -I 'nixpkgs=../../..' "$pkg") -json_set '.invidious.sha256' "$new_sha256" +new_hash=$(nix-prefetch -I 'nixpkgs=../../..' "$pkg") +json_set '.invidious.hash' "$new_hash" commit_msg="$pkg: $old_version -> $new_version" # fetch video.js dependencies @@ -61,8 +61,8 @@ 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 --type sha256 --base32 "$git_dir/assets/videojs") -json_set '.videojs.sha256' "$videojs_new_sha256" +videojs_new_hash=$(nix-hash --type sha256 --sri "$git_dir/assets/videojs") +json_set '.videojs.hash' "$videojs_new_hash" if git -C "$git_dir" diff-tree --quiet "${old_rev}..${new_rev}" -- 'shard.lock'; then info "shard.lock did not change since $old_rev." diff --git a/pkgs/servers/invidious/versions.json b/pkgs/servers/invidious/versions.json index 3ef940a876ffa..38a59c02413cb 100644 --- a/pkgs/servers/invidious/versions.json +++ b/pkgs/servers/invidious/versions.json @@ -1,10 +1,10 @@ { "invidious": { "rev": "e8a36985aff1a5b33ddf9abea85dd2c23422c2f7", - "sha256": "sha256-3nU6z1rd1oiNmIz3Ok02xBsT4oNSGX/n+3/WbRVCbhI=", + "hash": "sha256-3nU6z1rd1oiNmIz3Ok02xBsT4oNSGX/n+3/WbRVCbhI=", "version": "0.20.1-unstable-2024-02-18" }, "videojs": { - "sha256": "0zj8fgxdg6jsllaxn795xipa6yxh4yf08hb8x0idyg74q37gfh4c" + "hash": "sha256-jED3zsDkPN8i6GhBBJwnsHujbuwlHdsVpVqa1/pzSH4=" } } diff --git a/pkgs/servers/invidious/videojs.nix b/pkgs/servers/invidious/videojs.nix index 4016f8e1258d1..35ad0b1f06558 100644 --- a/pkgs/servers/invidious/videojs.nix +++ b/pkgs/servers/invidious/videojs.nix @@ -14,5 +14,5 @@ stdenvNoCC.mkDerivation { outputHashAlgo = "sha256"; outputHashMode = "recursive"; - outputHash = versions.videojs.sha256; + outputHash = versions.videojs.hash; } -- cgit 1.4.1