From d78bdd627dadf57fca8152c8a878123713a7b8b4 Mon Sep 17 00:00:00 2001 From: emilylange Date: Thu, 15 Feb 2024 01:20:30 +0100 Subject: [PATCH 1/4] sitespeed-io: unbreak build This package does not build with nodejs_20 yet. Yes, this package is heavily outdated (see shortly following commit), but even with the latest upstream version, it still won't build. To work around this, we pin the nodejs version down to nodejs_18. Additionally, makeWrapper isn't needed, as it is already included by default when using buildNpmPackage. And python3 isn't needed as nativeBuildInput (but very much needed further down below in postFixup for wrapping). --- pkgs/tools/networking/sitespeed-io/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/networking/sitespeed-io/default.nix b/pkgs/tools/networking/sitespeed-io/default.nix index f7b71b2fb4ca..5d9cd8112608 100644 --- a/pkgs/tools/networking/sitespeed-io/default.nix +++ b/pkgs/tools/networking/sitespeed-io/default.nix @@ -2,7 +2,7 @@ , stdenv , fetchFromGitHub , buildNpmPackage -, makeWrapper +, nodejs_18 , coreutils , ffmpeg-headless , imagemagick_light @@ -32,6 +32,8 @@ buildNpmPackage rec { hash = "sha256-Z4U4ZIw5Du/VSHIsGKdgu7wRv/6XVh/nMFDs8aYwkOQ="; }; + nodejs = nodejs_18; + postPatch = '' ln -s npm-shrinkwrap.json package-lock.json ''; @@ -41,8 +43,6 @@ buildNpmPackage rec { GECKODRIVER_SKIP_DOWNLOAD = true; EDGEDRIVER_SKIP_DOWNLOAD = true; - nativeBuildInputs = [ python3 makeWrapper ]; - dontNpmBuild = true; npmInstallFlags = [ "--omit=dev" ]; npmDepsHash = "sha256-RfZlXE8hnAJKiiWdOGFsAFGcxwgnLNvLrXeIinABFb0="; From 82f3ee85d50d7ec778fdb1b62e1bf741e2309fc8 Mon Sep 17 00:00:00 2001 From: emilylange Date: Thu, 15 Feb 2024 01:29:53 +0100 Subject: [PATCH 2/4] sitespeed-io: add `passthru.updateScript` This package lacks maintainance. Likely due to the past build failures. Let's try adding a confirmed working updateScript based on nix-update, so potential automations are able to pick this up easier. --- pkgs/tools/networking/sitespeed-io/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/tools/networking/sitespeed-io/default.nix b/pkgs/tools/networking/sitespeed-io/default.nix index 5d9cd8112608..70553fac2a14 100644 --- a/pkgs/tools/networking/sitespeed-io/default.nix +++ b/pkgs/tools/networking/sitespeed-io/default.nix @@ -9,6 +9,7 @@ , procps , python3 , xorg +, nix-update-script # chromedriver is more efficient than geckodriver, but is available on less platforms. @@ -81,6 +82,10 @@ buildNpmPackage rec { ${lib.optionalString (withFirefox && !withChromium) "--add-flags '-b firefox'"} ''; + passthru = { + updateScript = nix-update-script { }; + }; + meta = with lib; { description = "An open source tool that helps you monitor, analyze and optimize your website speed and performance"; homepage = "https://sitespeed.io"; From f36635be5f1890b7407b189d3515642fc42d9a68 Mon Sep 17 00:00:00 2001 From: emilylange Date: Thu, 15 Feb 2024 01:39:21 +0100 Subject: [PATCH 3/4] sitespeed-io: 27.3.1 -> 33.0.0 warning: there a many releases between 27.3.1 and 33.0.0 I won't individually link to here. The changelog further down below, however, lists all of them. https://github.com/sitespeedio/sitespeed.io/releases/tag/v33.0.0i changelog: https://github.com/sitespeedio/sitespeed.io/blob/v33.0.0/CHANGELOG.md diff: https://github.com/sitespeedio/sitespeed.io/compare/v27.3.1...v33.0.0 --- pkgs/tools/networking/sitespeed-io/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/networking/sitespeed-io/default.nix b/pkgs/tools/networking/sitespeed-io/default.nix index 70553fac2a14..846e386ced3b 100644 --- a/pkgs/tools/networking/sitespeed-io/default.nix +++ b/pkgs/tools/networking/sitespeed-io/default.nix @@ -24,13 +24,13 @@ assert (!withFirefox && !withChromium) -> throw "Either `withFirefox` or `withChromium` must be enabled."; buildNpmPackage rec { pname = "sitespeed-io"; - version = "27.3.1"; + version = "33.0.0"; src = fetchFromGitHub { owner = "sitespeedio"; repo = "sitespeed.io"; rev = "v${version}"; - hash = "sha256-Z4U4ZIw5Du/VSHIsGKdgu7wRv/6XVh/nMFDs8aYwkOQ="; + hash = "sha256-UmviwcxL67fn8B4ruJH9yKdcYVqmxqKSImQszKhDHZ0="; }; nodejs = nodejs_18; @@ -46,7 +46,7 @@ buildNpmPackage rec { dontNpmBuild = true; npmInstallFlags = [ "--omit=dev" ]; - npmDepsHash = "sha256-RfZlXE8hnAJKiiWdOGFsAFGcxwgnLNvLrXeIinABFb0="; + npmDepsHash = "sha256-FggwOnuQ+azgdLxfc6EUAsbl0+il6/2+p1t7MCrTNgE="; postInstall = '' mv $out/bin/sitespeed{.,-}io From bc47f473bea509c5d55497763acd50a8de51c993 Mon Sep 17 00:00:00 2001 From: emilylange Date: Thu, 15 Feb 2024 01:41:11 +0100 Subject: [PATCH 4/4] sharedown: unbreak build This is essentially a partial revert of c271196d42a99c038472994b0fd0bfd9028b4423 which was a successful attempt at unbreaking this build back in November 2023. That workaround, however, no longer, well.. works. Instead I figured out what was wrong with the initial version and fixed that. Hopefully this fix lasts longer than the one before. The important bit that was missing is that `export npm_config_nodedir` line. The code in question is copied from https://nixos.org/manual/nixpkgs/unstable/#javascript-yarn2nix-pitfalls https://github.com/NixOS/nixpkgs/blob/d176767c02cb2a048e766215078c3d231e666091/doc/languages-frameworks/javascript.section.md#pitfalls-javascript-yarn2nix-pitfalls) I suggest following the link for even more links as to why some commands from there are the way they are. --- pkgs/tools/misc/sharedown/default.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/misc/sharedown/default.nix b/pkgs/tools/misc/sharedown/default.nix index 5d1d31b35ac1..c3e87328c1fb 100644 --- a/pkgs/tools/misc/sharedown/default.nix +++ b/pkgs/tools/misc/sharedown/default.nix @@ -6,7 +6,7 @@ , libsecret , python3 , pkg-config -, nodePackages +, nodejs , electron , makeWrapper , makeDesktopItem @@ -63,7 +63,6 @@ stdenvNoCC.mkDerivation rec { nativeBuildInputs = [ python3 pkg-config - nodePackages.node-gyp ]; buildInputs = [ libsecret @@ -76,6 +75,15 @@ stdenvNoCC.mkDerivation rec { }; }; + # needed for node-gyp, copied from https://nixos.org/manual/nixpkgs/unstable/#javascript-yarn2nix-pitfalls + # permalink: https://github.com/NixOS/nixpkgs/blob/d176767c02cb2a048e766215078c3d231e666091/doc/languages-frameworks/javascript.section.md#pitfalls-javascript-yarn2nix-pitfalls + preBuild = '' + mkdir -p $HOME/.node-gyp/${nodejs.version} + echo 9 > $HOME/.node-gyp/${nodejs.version}/installVersion + ln -sfv ${nodejs}/include $HOME/.node-gyp/${nodejs.version} + export npm_config_nodedir=${nodejs} + ''; + packageJSON = "${src}/package.json"; yarnLock = ./yarn.lock;