-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
204 lines (180 loc) · 5.13 KB
/
flake.nix
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
{
description = "mergeable-etcd";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
crate2nix.url = "github:jeffa5/crate2nix";
};
outputs = {
self,
nixpkgs,
rust-overlay,
flake-utils,
crate2nix,
}: let
system = "x86_64-linux";
pkgs =
import nixpkgs
{
overlays = [rust-overlay.overlays.default];
system = system;
};
lib = pkgs.lib;
rust = pkgs.rust-bin.stable.latest.default;
buildRustCrate = pkgs.buildRustCrate.override {rustc = rust;};
cargoNix = pkgs.callPackage ./Cargo.nix {
buildRustCrateForPkgs = pkgs: buildRustCrate;
defaultCrateOverrides =
pkgs.defaultCrateOverrides
// {
mergeable-proto = attrs: {
buildInputs = [pkgs.protobuf];
PROTOC = "${pkgs.protobuf}/bin/protoc";
};
peer-proto = attrs: {
buildInputs = [pkgs.protobuf];
PROTOC = "${pkgs.protobuf}/bin/protoc";
};
etcd-proto = attrs: {
buildInputs = [pkgs.protobuf];
PROTOC = "${pkgs.protobuf}/bin/protoc";
};
};
};
workspacePackages = lib.attrsets.mapAttrs (name: value: value.build) cargoNix.workspaceMembers;
container-registry = "jeffas";
python = pkgs.python3.withPackages (ps: with ps; [numpy pandas matplotlib seaborn]);
in {
packages.${system} = {
inherit python;
inherit
(workspacePackages)
bencher
dismerge
dismerge-client
mergeable-etcd
exp-bencher
exp-automerge-changes
exp-automerge-diff
exp-automerge-sync
;
docker-bencher = pkgs.dockerTools.buildLayeredImage {
name = "${container-registry}/bencher";
tag = "latest";
contents = [
pkgs.iptables
pkgs.iproute2 # for tc
pkgs.busybox
self.packages.${system}.bencher
];
config.Cmd = ["/bin/bencher"];
};
docker-mergeable-etcd = pkgs.dockerTools.buildLayeredImage {
name = "${container-registry}/mergeable-etcd";
tag = "latest";
contents = [
pkgs.iptables
pkgs.iproute2 # for tc
pkgs.busybox
self.packages.${system}.mergeable-etcd
];
config.Cmd = ["/bin/mergeable-etcd-bytes"];
};
docker-dismerge = pkgs.dockerTools.buildLayeredImage {
name = "${container-registry}/dismerge";
tag = "latest";
contents = [
pkgs.iptables
pkgs.iproute2 # for tc
pkgs.busybox
self.packages.${system}.dismerge
];
config.Cmd = ["/bin/dismerge-bytes"];
};
docker-etcd = pkgs.dockerTools.buildLayeredImage {
name = "${container-registry}/etcd";
tag = "v${pkgs.etcd_3_5.version}";
contents = [
pkgs.iptables
pkgs.iproute2 # for tc
pkgs.busybox
pkgs.etcd_3_5
];
config.Cmd = ["/bin/etcd"];
};
};
apps.${system} = {
mergeable-etcd-bytes = flake-utils.lib.mkApp {
name = "mergeable-etcd-bytes";
drv = self.packages.${system}.mergeable-etcd-bytes;
};
mergeable-etcd-json = flake-utils.lib.mkApp {
name = "mergeable-etcd-json";
drv = self.packages.${system}.mergeable-etcd-json;
};
dismerge-bytes = flake-utils.lib.mkApp {
name = "dismerge-bytes";
drv = self.packages.${system}.dismerge-bytes;
};
dismerge-json = flake-utils.lib.mkApp {
name = "dismerge-json";
drv = self.packages.${system}.dismerge-json;
};
experiments = flake-utils.lib.mkApp {
name = "experiments";
drv = self.packages.${system}.experiments;
};
bencher = flake-utils.lib.mkApp {
name = "bencher";
drv = self.packages.${system}.bencher;
};
etcd = flake-utils.lib.mkApp {
name = "etcd";
drv = pkgs.etcd_3_5;
};
etcdctl = flake-utils.lib.mkApp {
name = "etcdctl";
drv = pkgs.etcd_3_5;
};
};
checks.${system} = self.packages.${system};
formatter.${system} = pkgs.alejandra;
devShells.${system}.default = pkgs.mkShell {
packages = with pkgs;
[
(rust.override {
extensions = ["rust-src" "rustfmt"];
targets = ["x86_64-unknown-linux-musl"];
})
mold
cargo-edit
cargo-watch
cargo-udeps
cargo-flamegraph
cargo-outdated
cargo-insta
protobuf
kubectl
k9s
rust-analyzer
jupyter
black
linuxPackages.perf
cmake
pkg-config
openssl
freetype
expat
fontconfig
cfssl
etcd
]
++ [python]
++ [crate2nix.packages.${system}.crate2nix];
ETCDCTL_API = 3;
PROTOC = "${pkgs.protobuf}/bin/protoc";
TK_LIBRARY = "${pkgs.tk}/lib/${pkgs.tk.libPrefix}";
};
};
}