From ca965ec64f5c4925f9bba3b7e18bc2b41d8dcc56 Mon Sep 17 00:00:00 2001 From: Jeremy Fleischman Date: Sun, 15 Dec 2024 22:41:05 -0800 Subject: [PATCH] cryptpad: verify that we've installed the correct versions of OnlyOffice With this change, I saw the following when I built cryptpad: ``` $ nix build .#cryptpad ... > v1 was up to date > v2b was up to date > v4 was up to date > v5 was up to date > v6 was up to date > Wrong commit of /nix/store/1m2d8c4fppfav7n2s4fvali3iira2ky2-cryptpad-2024.9.1/lib/node_modules/cryptpad/www/common/onlyoffice/dist/v7 found. Expected: e1267803. Actual: 9d8b914a ``` This reproduces the issue @martinetd noticed in . I then addressed these issue by fixing the commit we use for `v7` of OnlyOffice. --- pkgs/by-name/cr/cryptpad/package.nix | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/cr/cryptpad/package.nix b/pkgs/by-name/cr/cryptpad/package.nix index 4b0cbdd0dcaf..c93539a5bd67 100644 --- a/pkgs/by-name/cr/cryptpad/package.nix +++ b/pkgs/by-name/cr/cryptpad/package.nix @@ -1,6 +1,8 @@ { + bash, buildNpmPackage, fetchFromGitHub, + fetchpatch, fetchurl, lib, makeBinaryWrapper, @@ -56,8 +58,8 @@ let } { subdir = "v7"; - rev = "9d8b914a"; - hash = "sha256-M+rPJ/Xo2olhqB5ViynGRaesMLLfG/1ltUoLnepMPnM="; + rev = "e1267803"; + hash = "sha256-iIds0GnCHAyeIEdSD4aCCgDtnnwARh3NE470CywseS0="; } ]; @@ -90,12 +92,19 @@ buildNpmPackage { makeBinaryWrapper rdfind unzip + bash ]; patches = [ # fix httpSafePort setting # https://github.com/cryptpad/cryptpad/pull/1571 ./0001-env.js-fix-httpSafePort-handling.patch + # https://github.com/cryptpad/cryptpad/pull/1740 + (fetchpatch { + name = "Add `--check`, `--rdfind`, `--no-rdfind` options to `install-onlyoffice.sh`"; + url = "https://github.com/cryptpad/cryptpad/commit/f38668735e777895db2eadd3413cff386fb12c0c.patch"; + hash = "sha256-J4AK1XIa3q+/lD74p2c9O7jt0VEtofTmfAaQNU71sp8="; + }) ]; # cryptpad build tries to write in cache dir @@ -121,7 +130,11 @@ buildNpmPackage { mkdir -p "$out_cryptpad/www/common/onlyoffice/dist" ${lib.concatMapStringsSep "\n" onlyoffice_install onlyoffice_versions} ${x2t_install} - rdfind -makehardlinks true -makeresultsfile false "$out_cryptpad/www/common/onlyoffice/dist" + # Run upstream's `install-onlyoffice.sh` script in `--check` mode to + # verify that we've installed the correct versions of the various + # OnlyOffice components. + patchShebangs --build $out_cryptpad/install-onlyoffice.sh + $out_cryptpad/install-onlyoffice.sh --accept-license --check --rdfind # cryptpad assumes it runs in the source directory and also outputs # its state files there, which is not exactly great for us.