Skip to content

Commit

Permalink
wrangler: support darwin and arm64
Browse files Browse the repository at this point in the history
(cherry picked from commit a3a1a7e)
  • Loading branch information
ulrikstrid authored and github-actions[bot] committed Dec 11, 2023
1 parent c11b7c2 commit c3cbb35
Showing 1 changed file with 55 additions and 16 deletions.
71 changes: 55 additions & 16 deletions pkgs/development/node-packages/overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -418,22 +418,61 @@ final: prev: {
buildInputs = [ final.node-gyp-build ];
};

wrangler = prev.wrangler.override (oldAttrs: {
meta = oldAttrs.meta // { broken = before "16.13"; };
buildInputs = [ pkgs.llvmPackages.libcxx pkgs.llvmPackages.libunwind ] ++ lib.optional stdenv.isLinux pkgs.autoPatchelfHook;
preFixup = ''
# patch elf is trying to patch binary for sunos
rm -r $out/lib/node_modules/wrangler/node_modules/@esbuild/sunos-x64
'';
dependencies = oldAttrs.dependencies ++ lib.optional stdenv.isLinux ({
name = "_at_cloudflare_slash_workerd-linux-64";
packageName = "@cloudflare/workerd-linux-64";
# Should be same version as workerd
version = "1.20231030.0";
src = fetchurl {
url = "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20231030.0.tgz";
sha512 = "2HUeRTvoCC17fxE0qdBeR7J9dO8j4A8ZbdcvY8pZxdk+zERU6+N03RTbk/dQMU488PwiDvcC3zZqS4gwLfVT8g==";
wrangler = prev.wrangler.override (oldAttrs:
let
linuxWorkerd = {
name = "_at_cloudflare_slash_workerd-linux-64";
packageName = "@cloudflare/workerd-linux-64";
# Should be same version as workerd
version = "1.20231030.0";
src = fetchurl {
url = "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20231030.0.tgz";
sha512 = "2HUeRTvoCC17fxE0qdBeR7J9dO8j4A8ZbdcvY8pZxdk+zERU6+N03RTbk/dQMU488PwiDvcC3zZqS4gwLfVT8g==";
};
};
linuxWorkerdArm = {
name = "_at_cloudflare_slash_workerd-linux-arm64";
packageName = "@cloudflare/workerd-linux-arm64";
# Should be same version as workerd
version = "1.20231030.0";
src = fetchurl {
url = "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20231030.0.tgz";
sha512 = "4/GK5zHh+9JbUI6Z5xTCM0ZmpKKHk7vu9thmHjUxtz+o8Ne9DoD7DlDvXQWgMF6XGaTubDWyp3ttn+Qv8jDFuQ==";
};
};
darwinWorkerd = {
name = "_at_cloudflare_slash_workerd-darwin-64";
packageName = "@cloudflare/workerd-darwin-64";
# Should be same version as workerd
version = "1.20231030.0";
src = fetchurl {
url = "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20231030.0.tgz";
sha512 = "0iy34j997llj3jl3l8dipnsyms89qv9nxkza9l2gxmcj6mqwv5m6c8cvgca78qfccl1f5zsrzj855q1fz631p91yydbri2gxgvd10r7";
};
};
darwinWorkerdArm = {
name = "_at_cloudflare_slash_workerd-darwin-arm64";
packageName = "@cloudflare/workerd-darwin-arm64";
# Should be same version as workerd
version = "1.20231030.0";
src = fetchurl {
url = "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20231030.0.tgz";
sha512 = "WSJJjm11Del4hSneiNB7wTXGtBXI4QMCH9l5qf4iT5PAW8cESGcCmdHtWDWDtGAAGcvmLT04KNvmum92vRKKQQ==";
};
};

in
{
meta = oldAttrs.meta // { broken = before "16.13"; };
buildInputs = [ pkgs.llvmPackages.libcxx pkgs.llvmPackages.libunwind ] ++ lib.optional stdenv.isLinux pkgs.autoPatchelfHook;
preFixup = ''
# patch elf is trying to patch binary for sunos
rm -r $out/lib/node_modules/wrangler/node_modules/@esbuild/sunos-x64
'';
dependencies = oldAttrs.dependencies
++ lib.optional (stdenv.isLinux && stdenv.isx86_64) linuxWorkerd
++ lib.optional (stdenv.isLinux && stdenv.isAarch64) linuxWorkerdArm
++ lib.optional (stdenv.isDarwin && stdenv.isx86_64) darwinWorkerd
++ lib.optional (stdenv.isDarwin && stdenv.isAarch64) darwinWorkerdArm;
});
});
}

0 comments on commit c3cbb35

Please sign in to comment.