-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathflake.nix
More file actions
157 lines (156 loc) · 4.8 KB
/
flake.nix
File metadata and controls
157 lines (156 loc) · 4.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
{
self,
nixpkgs,
flake-utils,
treefmt-nix,
rust-overlay,
}:
let
prisma-factory =
{ pkgs, ... }@args:
(import ./prisma.nix) (
args
// {
rust-bin = rust-overlay.lib.mkRustBin { } pkgs.pkgsBuildBuild;
}
);
in
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
yarn-v1 = pkgs.writeShellApplication {
name = "yarn-v1";
checkPhase = "";
runtimeInputs = [ pkgs.yarn ];
text = "yarn $@";
};
yarn-berry = pkgs.writeShellApplication {
name = "yarn-berry";
checkPhase = "";
runtimeInputs = [ pkgs.yarn-berry ];
text = "yarn $@";
};
treefmt = treefmt-nix.lib.evalModule pkgs {
# nixfmt is nixfmt-rfc-style
programs.nixfmt.enable = true;
};
in
{
formatter = treefmt.config.build.wrapper;
checks =
(pkgs.callPackages ./tests.nix {
fetcherMode = "new";
inherit
pkgs
prisma-factory
yarn-v1
yarn-berry
;
})
// (pkgs.callPackages ./tests.nix {
fetcherMode = "legacy";
inherit
pkgs
prisma-factory
yarn-v1
yarn-berry
;
})
// (pkgs.callPackages ./tests.nix {
fetcherMode = "fromPkgs";
inherit
pkgs
prisma-factory
yarn-v1
yarn-berry
;
})
// {
format = treefmt.config.build.check self;
fetcher-assert-npm =
let
# force download debian for consistent hash across systems
binaryTargetBySystem = {
x86_64-linux = "debian";
aarch64-linux = "debian";
x86_64-darwin = "debian";
aarch64-darwin = "debian";
};
prisma-legacy = prisma-factory {
inherit pkgs binaryTargetBySystem;
hash = "sha256-R9PG286KQTbzF0r/PPcShUkMiYam2prRh/JICjmhCZA=";
};
prisma-new =
lockName: lockFile:
prisma-factory {
inherit pkgs binaryTargetBySystem;
hash = "sha256-R9PG286KQTbzF0r/PPcShUkMiYam2prRh/JICjmhCZA=";
${lockName} = lockFile;
};
in
assert
(prisma-legacy.fromNpmLock ./npm/package-lock.json).env
== (prisma-new "npmLock" ./npm/package-lock.json).env;
pkgs.hello;
prisma-next =
(self.lib.prisma-factory {
pkgs = pkgs;
versionString = "6.20.0-16.next-0c19ccc313cf9911a90d99d2ac2eb0280c76c513";
hash =
{
x86_64-linux = "sha256-JWX+N/mmp9uJLcv4XFbQ3yg34fFf2BLIUpOLrrfTjEM=";
x86_64-darwin = "sha256-WNwFOoeDOebbfAh4y/NvZCyE9otaJdg2hHb4ifEFD+Y=";
aarch64-linux = "sha256-f9FuPZaGx0FwKo4pA9f8g82MTcAzYLwWslxjb7oqk6E=";
aarch64-darwin = "sha256-NMI+JcP3epBO3V37D19TDgzivMnPekgrYqUrXB6qNV0=";
}
.${pkgs.system};
}).package;
};
packages.default =
(prisma-factory {
inherit pkgs;
hash = "sha256-R9PG286KQTbzF0r/PPcShUkMiYam2prRh/JICjmhCZA=";
versionString = "5.1.1-1.6a3747c37ff169c90047725a05a6ef02e32ac97e";
}).package;
devShells.default =
let
prisma = (
prisma-factory {
inherit pkgs;
hash = "sha256-R9PG286KQTbzF0r/PPcShUkMiYam2prRh/JICjmhCZA=";
versionString = "5.1.1-1.6a3747c37ff169c90047725a05a6ef02e32ac97e";
}
);
in
pkgs.mkShell {
buildInputs = [
pkgs.nodejs_24
pkgs.pnpm
pkgs.bun
pkgs.stdenv.cc.cc.lib
prisma.package
pkgs.nixfmt-rfc-style
yarn-v1
yarn-berry
];
env = prisma.env;
};
}
)
// {
lib = {
inherit prisma-factory;
};
};
}