mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-17 06:06:13 +03:00
grafana: fix the darwin build failure
* use xcbuild.xcbuild, which is dep for @esfx/equatable; fix 'aligned_alloc' error * frontend's offlineCache: don't allow platforms other than the one's mentioned in `meta.platforms`
This commit is contained in:
parent
34cfa58e79
commit
f5e484111e
@ -2,7 +2,7 @@
|
||||
, tzdata, wire
|
||||
, yarn, nodejs, python3, cacert
|
||||
, jq, moreutils
|
||||
, nix-update-script, nixosTests
|
||||
, nix-update-script, nixosTests, xcbuild
|
||||
}:
|
||||
|
||||
let
|
||||
@ -32,13 +32,21 @@ buildGoModule rec {
|
||||
hash = "sha256-Rp2jGspbmqJFzSbiVy2/5oqQJnAdGG/T+VNBHVsHSwg=";
|
||||
};
|
||||
|
||||
# borrowed from: https://github.com/NixOS/nixpkgs/blob/d70d9425f49f9aba3c49e2c389fe6d42bac8c5b0/pkgs/development/tools/analysis/snyk/default.nix#L20-L22
|
||||
env = lib.optionalAttrs (stdenv.isDarwin && stdenv.isx86_64) {
|
||||
# Fix error: no member named 'aligned_alloc' in the global namespace.
|
||||
# Occurs while building @esfx/equatable@npm:1.0.2 on x86_64-darwin
|
||||
NIX_CFLAGS_COMPILE = "-D_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION=1";
|
||||
};
|
||||
|
||||
offlineCache = stdenv.mkDerivation {
|
||||
name = "${pname}-${version}-yarn-offline-cache";
|
||||
inherit src;
|
||||
inherit src env;
|
||||
nativeBuildInputs = [
|
||||
yarn nodejs cacert
|
||||
jq moreutils python3
|
||||
];
|
||||
# @esfx/equatable@npm:1.0.2 fails to build on darwin as it requires `xcbuild`
|
||||
] ++ lib.optionals stdenv.isDarwin [ xcbuild.xcbuild ];
|
||||
postPatch = ''
|
||||
${patchAwayGrafanaE2E}
|
||||
'';
|
||||
@ -47,7 +55,7 @@ buildGoModule rec {
|
||||
export HOME="$(mktemp -d)"
|
||||
yarn config set enableTelemetry 0
|
||||
yarn config set cacheFolder $out
|
||||
yarn config set --json supportedArchitectures.os '[ "linux" ]'
|
||||
yarn config set --json supportedArchitectures.os '[ "linux", "darwin" ]'
|
||||
yarn config set --json supportedArchitectures.cpu '["arm", "arm64", "ia32", "x64"]'
|
||||
yarn
|
||||
runHook postBuild
|
||||
@ -56,14 +64,21 @@ buildGoModule rec {
|
||||
dontInstall = true;
|
||||
dontFixup = true;
|
||||
outputHashMode = "recursive";
|
||||
outputHash = "sha256-QdyXSPshzugkDTJoUrJlHNuhPAyR9gae5Cbk8Q8FSl4=";
|
||||
outputHash = rec {
|
||||
x86_64-linux = "sha256-3CZgs732c6Z64t2sfWjPAmMFKVTzoolv2TwrbjeRCBA=";
|
||||
aarch64-linux = x86_64-linux;
|
||||
aarch64-darwin = "sha256-NKEajOe9uDZw0MF5leiKBIRH1CHUELRho7gyCa96BO8=";
|
||||
x86_64-darwin = aarch64-darwin;
|
||||
}.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
||||
};
|
||||
|
||||
disallowedRequisites = [ offlineCache ];
|
||||
|
||||
vendorHash = "sha256-cNkMVLXp3hPMcW0ilOM0VlrrDX/IsZaze+/6qlTfmRs=";
|
||||
vendorHash = "sha256-puPgbgfRqbPvMVks+gyOPOTTfdClWqbOf89X0ihMLPY=";
|
||||
|
||||
nativeBuildInputs = [ wire yarn jq moreutils removeReferencesTo python3 ];
|
||||
proxyVendor = true;
|
||||
|
||||
nativeBuildInputs = [ wire yarn jq moreutils removeReferencesTo python3 ] ++ lib.optionals stdenv.isDarwin [ xcbuild.xcbuild ];
|
||||
|
||||
postPatch = ''
|
||||
${patchAwayGrafanaE2E}
|
||||
|
Loading…
Reference in New Issue
Block a user