Skip to content

Commit f21d11c

Browse files
authored
Merge pull request #7 from Ovyerus/fix/darwin
Use the correct `libquery_engine` name under Darwin
2 parents 3bf9285 + 1df25b1 commit f21d11c

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

prisma.nix

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ rec {
2222
hostname = "binaries.prisma.sh";
2323
channel = "all_commits";
2424
binaryTarget = binaryTargetBySystem.${nixpkgs.system};
25-
target = "${binaryTarget}-openssl-${opensslVersion}";
25+
isDarwin = nixpkgs.lib.strings.hasPrefix "darwin" binaryTarget;
26+
target = if isDarwin then
27+
binaryTarget
28+
else
29+
"${binaryTarget}-openssl-${opensslVersion}";
2630
baseUrl = "https://${hostname}/${channel}";
2731
files =
2832
[
@@ -39,7 +43,10 @@ rec {
3943
variable = "PRISMA_QUERY_ENGINE_BINARY";
4044
}
4145
{
42-
name = "libquery_engine.so.node";
46+
name = if isDarwin then
47+
"libquery_engine.dylib.node"
48+
else
49+
"libquery_engine.so.node";
4350
hash = libquery-engine-hash;
4451
path = "lib/libquery_engine.node";
4552
variable = "PRISMA_QUERY_ENGINE_LIBRARY";
@@ -104,10 +111,11 @@ rec {
104111
pname = "prisma-bin";
105112
version = commit;
106113
nativeBuildInputs = [
107-
nixpkgs.autoPatchelfHook
108114
nixpkgs.zlib
109115
openssl
110116
nixpkgs.stdenv.cc.cc.lib
117+
] ++ nixpkgs.lib.optionals (!isDarwin) [
118+
nixpkgs.autoPatchelfHook
111119
];
112120
phases = [
113121
"buildPhase"

tests.nix

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ let
1414
libquery-engine-hash = "sha256-oalG9QKuxURtdgs5DgJZZtyWMz3ZpywHlov+d1ct2vA=";
1515
schema-engine-hash = "sha256-5bp8iiq6kc9c37G8dNKVHKWJHvaxFaetR4DOR/0/eWs=";
1616
};
17+
aarch64-darwin = {
18+
prisma-fmt-hash = "sha256-UPig7U2zXOccalIUE0j07xJdmqAUJ7cpXFTo+2Gbsc8=";
19+
query-engine-hash = "sha256-ihP1BEAvXQ+5XXHEXCYAVTnuETpfxmdtsIGRTljKtS0=";
20+
libquery-engine-hash = "sha256-4T63O+OyoEIJ0TLKoOoil06whd+41QxiXXg+0cgpX/8=";
21+
schema-engine-hash = "sha256-+O4IelHbZt4X+6UWol8TpL+BBDTS5JT+0hQR7ELVmZc=";
22+
};
1723
};
1824
test-npm =
1925
let
@@ -27,7 +33,7 @@ let
2733
echo "testing npm"
2834
${prisma.shellHook}
2935
cd npm
30-
npm ci
36+
${nixpkgs.nodejs}/bin/npm ci
3137
./node_modules/.bin/prisma generate
3238
'';
3339
};
@@ -43,7 +49,7 @@ let
4349
echo "testing pnpm"
4450
${prisma.shellHook}
4551
cd pnpm
46-
pnpm install
52+
${nixpkgs.pnpm}/bin/pnpm install
4753
./node_modules/.bin/prisma generate
4854
'';
4955
};

0 commit comments

Comments
 (0)