2323 channel = "all_commits" ;
2424 binaryTarget = binaryTargetBySystem . ${ nixpkgs . system } ;
2525 isDarwin = nixpkgs . lib . strings . hasPrefix "darwin" binaryTarget ;
26- target = if isDarwin then
27- binaryTarget
28- else
29- "${ binaryTarget } -openssl-${ opensslVersion } " ;
26+ target = if isDarwin then binaryTarget else "${ binaryTarget } -openssl-${ opensslVersion } " ;
3027 baseUrl = "https://${ hostname } /${ channel } " ;
3128 files =
3229 [
4340 variable = "PRISMA_QUERY_ENGINE_BINARY" ;
4441 }
4542 {
46- name = if isDarwin then
47- "libquery_engine.dylib.node"
48- else
49- "libquery_engine.so.node" ;
43+ name = if isDarwin then "libquery_engine.dylib.node" else "libquery_engine.so.node" ;
5044 hash = libquery-engine-hash ;
5145 path = "lib/libquery_engine.node" ;
5246 variable = "PRISMA_QUERY_ENGINE_LIBRARY" ;
@@ -110,13 +104,15 @@ rec {
110104 package = nixpkgs . stdenv . mkDerivation {
111105 pname = "prisma-bin" ;
112106 version = commit ;
113- nativeBuildInputs = [
114- nixpkgs . zlib
115- openssl
116- nixpkgs . stdenv . cc . cc . lib
117- ] ++ nixpkgs . lib . optionals ( ! isDarwin ) [
118- nixpkgs . autoPatchelfHook
119- ] ;
107+ nativeBuildInputs =
108+ [
109+ nixpkgs . zlib
110+ openssl
111+ nixpkgs . stdenv . cc . cc . lib
112+ ]
113+ ++ nixpkgs . lib . optionals ( ! isDarwin ) [
114+ nixpkgs . autoPatchelfHook
115+ ] ;
120116 phases = [
121117 "buildPhase"
122118 "postFixupHooks"
@@ -153,9 +149,7 @@ rec {
153149 "5" =
154150 pnpmLock :
155151 let
156- version = builtins . elemAt ( builtins . split ":" (
157- builtins . elemAt ( builtins . split ( "@prisma/engines-version/" ) pnpmLock ) 2
158- ) ) 0 ;
152+ version = builtins . elemAt ( builtins . split ":" ( builtins . elemAt ( builtins . split ( "@prisma/engines-version/" ) pnpmLock ) 2 ) ) 0 ;
159153 in
160154 nixpkgs . lib . lists . last ( nixpkgs . lib . strings . splitString "." version ) ;
161155
@@ -164,9 +158,7 @@ rec {
164158 "6" =
165159 pnpmLock :
166160 let
167- version = builtins . elemAt ( builtins . split ":" (
168- builtins . elemAt ( builtins . split ( "@prisma/engines-version@" ) pnpmLock ) 2
169- ) ) 0 ;
161+ version = builtins . elemAt ( builtins . split ":" ( builtins . elemAt ( builtins . split ( "@prisma/engines-version@" ) pnpmLock ) 2 ) ) 0 ;
170162 in
171163 nixpkgs . lib . lists . last ( nixpkgs . lib . strings . splitString "." version ) ;
172164
@@ -175,9 +167,7 @@ rec {
175167 "9" =
176168 pnpmLock :
177169 let
178- version = builtins . elemAt ( builtins . split "'" (
179- builtins . elemAt ( builtins . split ( "@prisma/engines-version@" ) pnpmLock ) 2
180- ) ) 0 ;
170+ version = builtins . elemAt ( builtins . split "'" ( builtins . elemAt ( builtins . split ( "@prisma/engines-version@" ) pnpmLock ) 2 ) ) 0 ;
181171 in
182172 nixpkgs . lib . lists . last ( nixpkgs . lib . strings . splitString "." version ) ;
183173 } ;
@@ -199,7 +189,8 @@ rec {
199189 commit = nixpkgs . lib . lists . last ( nixpkgs . lib . strings . splitString "." version ) ;
200190 in
201191 fromCommit commit ;
202- fromBunLock = path :
192+ fromBunLock =
193+ path :
203194 let
204195 # HACK: nix doesn't support JSONC parsing, so currently doing
205196 # 1. remove whitespace and newline
@@ -208,25 +199,35 @@ rec {
208199 # to support JSON with trailing comma.
209200 # Keep in mind that this removes all whitespaces / tab / newline in the key / value
210201 # and doesn't support comments.
211- fromJSONWithTrailingComma = jsonc :
212- builtins . fromJSON ( builtins . replaceStrings [ ",}" ",]" ] [ "}" "]" ] ( builtins . replaceStrings [ " " "\t " "\n " ] [ "" "" "" ] jsonc ) ) ;
202+ fromJSONWithTrailingComma =
203+ jsonc :
204+ builtins . fromJSON (
205+ builtins . replaceStrings [ ",}" ",]" ] [ "}" "]" ] (
206+ builtins . replaceStrings [ " " "\t " "\n " ] [ "" "" "" ] jsonc
207+ )
208+ ) ;
213209 bunLockParsers = {
214210 # example:
215211 # nu> open bun.lock | from json | get packages.@prisma/engines-version.0
216212217213 "0" = bunLockParsers . "1" ;
218- "1" = lock : afterLastDot ( builtins . elemAt (
219- lock . "packages" . "@prisma/engines-version"
220- or ( throw ''
221- nix-prisma-utils: lockfile parsing error: package @prisma/engines-version not found.
222- please make sure that you have @prisma/client installed.
223- '' )
224- ) 0 ) ;
214+ "1" =
215+ lock :
216+ afterLastDot (
217+ builtins . elemAt ( lock . "packages" . "@prisma/engines-version" or ( throw ''
218+ nix-prisma-utils: lockfile parsing error: package @prisma/engines-version not found.
219+ please make sure that you have @prisma/client installed.
220+ '' )
221+ ) 0
222+ ) ;
225223 } ;
226- lockfile = fromJSONWithTrailingComma ( assert builtins . typeOf path == "path" ; builtins . readFile path ) ;
224+ lockfile = fromJSONWithTrailingComma (
225+ assert builtins . typeOf path == "path" ;
226+ builtins . readFile path
227+ ) ;
227228 lockfileVersion = builtins . toString lockfile . "lockfileVersion" ;
228- parse = bunLockParsers . ${ lockfileVersion } or
229- ( throw ''
229+ parse =
230+ bunLockParsers . ${ lockfileVersion } or ( throw ''
230231 nix-prisma-utils: Unsupported lockfile version: ${ lockfileVersion }
231232 nix-prisma-utils currently supports bun.lock version of 0 and 1.
232233 '' ) ;
0 commit comments