From c9377b15aadc81ed9ae071a5dcbaeb44cf311fad Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 18 Feb 2025 08:02:03 +0900 Subject: [PATCH] opcua-commander: fix build on darwin (#382748) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * opcua-commander: fix build on darwin * opcua-commander: prefer optionalString to construct CLI arguments https://github.com/NixOS/nixpkgs/pull/382748#discussion_r1958311936 Co-authored-by: Sandro Jäckel Co-authored-by: Kenichi Kamiya --------- Co-authored-by: Sandro Jäckel --- pkgs/by-name/op/opcua-commander/package.nix | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/pkgs/by-name/op/opcua-commander/package.nix b/pkgs/by-name/op/opcua-commander/package.nix index 31f00279f875..ac137b7fe184 100644 --- a/pkgs/by-name/op/opcua-commander/package.nix +++ b/pkgs/by-name/op/opcua-commander/package.nix @@ -1,5 +1,6 @@ { lib, + stdenv, buildNpmPackage, fetchFromGitHub, typescript, @@ -25,10 +26,18 @@ buildNpmPackage rec { makeWrapper ]; - postPatch = '' - substituteInPlace package.json \ - --replace-warn "npx -y esbuild" "esbuild" - ''; + postPatch = + let + esbuildPrefix = + "esbuild" + # Workaround for 'No loader is configured for ".node" files: node_modules/fsevents/fsevents.node' + # esbuild issue is https://github.com/evanw/esbuild/issues/1051 + + lib.optionalString stdenv.hostPlatform.isDarwin " --external:fsevents"; + in + '' + substituteInPlace package.json \ + --replace-fail 'npx -y esbuild' '${esbuildPrefix}' + ''; # We need to add `nodejs` to PATH for `opcua-commander` to properly work # when connected to an OPC-UA server.