opcua-commander: fix build on darwin (#382748)

* 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 <sandro.jaeckel@gmail.com>
Co-authored-by: Kenichi Kamiya <kachick1@gmail.com>

---------

Co-authored-by: Sandro Jäckel <sandro.jaeckel@gmail.com>
This commit is contained in:
Kenichi Kamiya
2025-02-18 00:02:03 +01:00
committed by GitHub
co-authored by Sandro Jäckel
parent 29f6170dc8
commit c9377b15aa
+13 -4
View File
@@ -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.