|
1 | | -{ |
| 1 | +hashes@{ |
2 | 2 | # dependencies |
3 | 3 | lib, |
4 | 4 | fetchurl, |
|
7 | 7 | autoPatchelfHook, |
8 | 8 | # variables |
9 | 9 | openssl, |
10 | | - commit, |
11 | 10 | opensslVersion, |
12 | 11 | binaryTarget, |
13 | | - isv7, |
14 | 12 | # = hashes |
15 | 13 | prisma-fmt-hash, |
16 | 14 | query-engine-hash, |
17 | 15 | libquery-engine-hash, |
18 | 16 | introspection-engine-hash, |
19 | 17 | migration-engine-hash, |
20 | 18 | schema-engine-hash, |
| 19 | + version, |
| 20 | + callPackage, |
21 | 21 | }: |
22 | 22 | let |
23 | 23 | hostname = "binaries.prisma.sh"; |
24 | 24 | channel = "all_commits"; |
25 | 25 | isDarwin = lib.strings.hasPrefix "darwin" binaryTarget; |
26 | 26 | target = if isDarwin then binaryTarget else "${binaryTarget}-openssl-${opensslVersion}"; |
27 | 27 | baseUrl = "https://${hostname}/${channel}"; |
28 | | - files = |
29 | | - [ |
30 | | - { |
31 | | - name = "prisma-fmt"; |
32 | | - hash = prisma-fmt-hash; |
33 | | - path = "bin/prisma-fmt"; |
34 | | - variable = "PRISMA_FMT_BINARY"; |
35 | | - } |
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) [ |
51 | | - { |
52 | | - name = "query-engine"; |
53 | | - hash = query-engine-hash; |
54 | | - path = "bin/query-engine"; |
55 | | - variable = "PRISMA_QUERY_ENGINE_BINARY"; |
56 | | - } |
57 | | - { |
58 | | - name = if isDarwin then "libquery_engine.dylib.node" else "libquery_engine.so.node"; |
59 | | - hash = libquery-engine-hash; |
60 | | - path = "lib/libquery_engine.node"; |
61 | | - variable = "PRISMA_QUERY_ENGINE_LIBRARY"; |
62 | | - } |
63 | | - ] |
64 | | - ++ ( |
65 | | - if introspection-engine-hash == null then |
66 | | - [ ] |
67 | | - else |
68 | | - [ |
69 | | - { |
70 | | - name = "introspection-engine"; |
71 | | - hash = introspection-engine-hash; |
72 | | - path = "bin/introspection-engine"; |
73 | | - variable = "PRISMA_INTROSPECTION_ENGINE_BINARY"; |
74 | | - } |
75 | | - ] |
76 | | - ) |
77 | | - ++ ( |
78 | | - if migration-engine-hash == null then |
79 | | - [ ] |
80 | | - else |
81 | | - [ |
82 | | - { |
83 | | - name = "migration-engine"; |
84 | | - hash = migration-engine-hash; |
85 | | - path = "bin/migration-engine"; |
86 | | - variable = "PRISMA_MIGRATION_ENGINE_BINARY"; |
87 | | - } |
88 | | - ] |
89 | | - ); |
| 28 | + files = (callPackage ./components.nix { }).fromHashes { |
| 29 | + inherit |
| 30 | + prisma-fmt-hash |
| 31 | + query-engine-hash |
| 32 | + libquery-engine-hash |
| 33 | + introspection-engine-hash |
| 34 | + migration-engine-hash |
| 35 | + schema-engine-hash |
| 36 | + ; |
| 37 | + }; |
90 | 38 | downloadedFiles = builtins.map ( |
91 | 39 | file: |
92 | 40 | file |
93 | 41 | // { |
94 | 42 | file = fetchurl { |
95 | | - name = "${baseUrl}/${commit}/${target}/${file.name}.gz"; |
96 | | - url = "${baseUrl}/${commit}/${target}/${file.name}.gz"; |
97 | | - hash = file.hash; |
| 43 | + name = "${baseUrl}/${version.commit}/${target}/${file.getFileName isDarwin}"; |
| 44 | + url = "${baseUrl}/${version.commit}/${target}/${file.getFileName isDarwin}"; |
| 45 | + hash = hashes."${file.name}-hash"; |
98 | 46 | }; |
99 | 47 | } |
100 | 48 | ) files; |
|
136 | 84 | rec { |
137 | 85 | package = stdenv.mkDerivation { |
138 | 86 | pname = "prisma-bin"; |
139 | | - version = commit; |
| 87 | + version = version.commit; |
140 | 88 | nativeBuildInputs = [ |
141 | 89 | zlib |
142 | 90 | openssl |
|
0 commit comments