File tree Expand file tree Collapse file tree 4 files changed +48
-20
lines changed Expand file tree Collapse file tree 4 files changed +48
-20
lines changed Original file line number Diff line number Diff line change 8585 ( prisma-legacy . fromNpmLock ./npm/package-lock.json ) . env
8686 == ( prisma-new "npmLock" ./npm/package-lock.json ) . env ;
8787 pkgs . hello ;
88+ prisma-next =
89+ ( self . lib . prisma-factory {
90+ pkgs = pkgs ;
91+ _commit = "next-0c19ccc313cf9911a90d99d2ac2eb0280c76c513" ;
92+ hash =
93+ {
94+ x86_64-linux = "sha256-JWX+N/mmp9uJLcv4XFbQ3yg34fFf2BLIUpOLrrfTjEM=" ;
95+ x86_64-darwin = "sha256-WNwFOoeDOebbfAh4y/NvZCyE9otaJdg2hHb4ifEFD+Y=" ;
96+ aarch64-linux = "sha256-f9FuPZaGx0FwKo4pA9f8g82MTcAzYLwWslxjb7oqk6E=" ;
97+ aarch64-darwin = "sha256-NMI+JcP3epBO3V37D19TDgzivMnPekgrYqUrXB6qNV0=" ;
98+ }
99+ . ${ pkgs . system } ;
100+ } ) . package ;
88101 } ;
89102 packages . default =
90103 ( prisma-factory {
Original file line number Diff line number Diff line change 1414 binaryTarget ,
1515 hash ,
1616 components ,
17+ isv7 ,
1718} :
1819let
1920 componentsToFetch =
2627 path = "bin/prisma-fmt" ;
2728 env = "PRISMA_FMT_BINARY" ;
2829 }
30+ {
31+ url = "schema-engine.gz" ;
32+ path = "bin/schema-engine" ;
33+ env = "PRISMA_SCHEMA_ENGINE_BINARY" ;
34+ }
35+ ]
36+ ++ lib . optionals ( ! isv7 ) [
2937 {
3038 url = "query-engine.gz" ;
3139 path = "bin/query-engine" ;
3644 path = "lib/libquery_engine.node" ;
3745 env = "PRISMA_QUERY_ENGINE_LIBRARY" ;
3846 }
39- {
40- url = "schema-engine.gz" ;
41- path = "bin/schema-engine" ;
42- env = "PRISMA_SCHEMA_ENGINE_BINARY" ;
43- }
4447 ] ;
4548 isDarwin = lib . strings . hasPrefix "darwin" binaryTarget ;
4649 target = if isDarwin then binaryTarget else "${ binaryTarget } -openssl-${ opensslVersion } " ;
6366 mkdir -p $out $out/lib $out/bin
6467 ${ lib . concatLines (
6568 map ( component : ''
69+ echo '[nix-prisma-utils] fetching ${ toUrl component . url } to $out/${ component . path } '
6670 curl "${ toUrl component . url } " -L | gunzip > $out/${ component . path }
6771 '' ) componentsToFetch
6872 ) }
Original file line number Diff line number Diff line change 1010 commit ,
1111 opensslVersion ,
1212 binaryTarget ,
13+ isv7 ,
1314 # = hashes
1415 prisma-fmt-hash ,
1516 query-engine-hash ,
3233 path = "bin/prisma-fmt" ;
3334 variable = "PRISMA_FMT_BINARY" ;
3435 }
36+ ]
37+ ++ (
38+ if schema-engine-hash == null then
39+ [ ]
40+ else
41+ [
42+ {
43+ name = "schema-engine" ;
44+ hash = schema-engine-hash ;
45+ path = "bin/schema-engine" ;
46+ variable = "PRISMA_SCHEMA_ENGINE_BINARY" ;
47+ }
48+ ]
49+ )
50+ ++ lib . optionals ( ! isv7 ) [
3551 {
3652 name = "query-engine" ;
3753 hash = query-engine-hash ;
7086 variable = "PRISMA_MIGRATION_ENGINE_BINARY" ;
7187 }
7288 ]
73- )
74- ++ (
75- if schema-engine-hash == null then
76- [ ]
77- else
78- [
79- {
80- name = "schema-engine" ;
81- hash = schema-engine-hash ;
82- path = "bin/schema-engine" ;
83- variable = "PRISMA_SCHEMA_ENGINE_BINARY" ;
84- }
85- ]
8689 ) ;
8790 downloadedFiles = builtins . map (
8891 file :
Original file line number Diff line number Diff line change 3131 parsers = pkgs . callPackage ./lib/parsers.nix { } ;
3232 binaryTarget = binaryTargetBySystem . ${ pkgs . system } ;
3333 fromCommit =
34- commit :
34+ _commit :
35+ let
36+ # HACK: _commit may be "next-0c19ccc313cf9911a90d99d2ac2eb0280c76c513" instead of "0c19ccc313cf9911a90d99d2ac2eb0280c76c513"
37+ commit = lib . strings . removePrefix "next-" _commit ;
38+ # prisma >= v7 has fewer components
39+ isv7 = lib . strings . hasPrefix "next-" _commit ;
40+ in
3541 if builtins . stringLength commit != 40 then
3642 throw "invalid commit: got ${ commit } "
3743 else if hash != null then
44+ # use new fetcher
3845 pkgs . callPackage ./lib/fetcher.nix {
3946 inherit
4047 commit
4350 binaryTarget
4451 hash
4552 components
53+ isv7
4654 ;
4755 }
48- # use new fetcher
4956 else
5057 pkgs . callPackage ./lib/legacyFetcher.nix {
5158 inherit
5259 commit
5360 openssl
5461 opensslVersion
5562 binaryTarget
63+ isv7
5664 prisma-fmt-hash
5765 query-engine-hash
5866 libquery-engine-hash
You can’t perform that action at this time.
0 commit comments