forked from F1R3FLY-io/f1r3node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
195 lines (192 loc) · 6.24 KB
/
flake.nix
File metadata and controls
195 lines (192 loc) · 6.24 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
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
{
inputs = {
typelevel-nix.url = "github:typelevel/typelevel-nix";
nixpkgs.follows = "typelevel-nix/nixpkgs";
oldNixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
flake-utils.follows = "typelevel-nix/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
nixpkgs-23.url = "github:NixOS/nixpkgs/d4f247e89f6e10120f911e2e2d2254a050d0f732"; #https://www.nixhub.io/packages/tree-sitter
naersk.url = "github:nix-community/naersk";
cross-src.url = "github:cross-rs/cross";
cross-src.flake = false;
};
outputs = { self, nixpkgs, oldNixpkgs, flake-utils, typelevel-nix, rust-overlay, nixpkgs-23, naersk, cross-src }:
flake-utils.lib.eachDefaultSystem (system:
let
graalOverlay = final: prev: rec {
holyGraal = final.jdk17;
jdk = holyGraal;
jre = holyGraal;
};
ammOverlay = final: prev: {
hematite = prev.ammonite.overrideAttrs rec {
version = "2.5.11";
src = builtins.fetchurl {
url =
"https://github.com/lihaoyi/Ammonite/releases/download/${version}/2.12-${version}";
sha256 = "0ycwdcpprfd195i5f2ds03z2vpifv8fky6i9wh9v328z0glnjwrg";
};
};
};
overlays = [ typelevel-nix.overlay (import rust-overlay) graalOverlay ammOverlay ];
pkgs = import nixpkgs {
inherit system overlays;
config.allowUnfree = true;
};
pkgs23 = import nixpkgs-23 { inherit system; };
naersk-lib = naersk.lib."${system}".override {
cargo = pkgs.rust-bin.stable.latest.minimal;
rustc = pkgs.rust-bin.stable.latest.minimal;
};
cross = naersk-lib.buildPackage {
pname = "cross";
root = cross-src;
nativeBuildInputs = with pkgs; [ pkg-config ];
buildInputs = with pkgs; [ openssl ];
};
in
with pkgs;
{
devShells.default = devshell.mkShell {
commands = [
# Note: Using system Docker client (Docker Desktop) instead of nix package
# to ensure API version compatibility with the Docker daemon
{
name = "protoc";
package = protobuf;
help = "Protocol Buffers compiler";
}
{
name = "rustup";
package = rustup;
help = "The Rust toolchain installer";
}
] ++ (if system != "x86_64-darwin" && system != "aarch64-darwin" then [{
name = "gcc";
package = gcc;
help = "GNU C compiler";
}] else []) ++ [
{
name = "make";
package = gnumake;
help = "GNU Make build tool";
}
{
name = "pkg-config";
package = pkg-config;
help = "Helper tool for compiling applications";
}
{
name = "bnfc";
package = "haskellPackages.BNFC";
help = "EBNF parser generator targeting several languages";
}
{
name = "jflex";
package = "jflex";
help = "Java lexical analyzer generator";
}
{
name = "amm";
package = hematite;
help = "Ammonite REPL for Scala";
}
{
name = "grpcurl";
package = grpcurl;
help = "CURL-inspired CLI for gRPC services";
}
{
name = "minikube";
package = minikube;
help = "Local Kubernetes cluster CLI";
}
{
name = "kubectl";
package = kubectl;
help = "Kubernetes CLI";
}
{
name = "oci";
package = oci-cli;
help = "Oracle Cloud CLI";
}
{
name = "dhall";
package = dhall;
help = "Dhall configuration language";
}
{
name = "dhall-to-yaml-ng";
package = dhall-yaml;
help = "Dhall-to-YAML utility";
}
{
name = "tree-sitter";
package = pkgs23.tree-sitter;
help = "Parser generator tool and incremental parsing library";
}
{
name = "cross";
package = cross;
help = "Cross-compilation of Rust projects made easy";
}
{
name = "python3";
package = python310;
help = "Python 3.10 interpreter";
}
{
name = "pipenv";
package = pipenv;
help = "Python dependency management tool";
}
{
name = "just";
package = just;
help = "Just command runner for local development tasks";
}
];
packages = [
# Required for Python packages with native extensions (grpcio, etc.)
stdenv.cc.cc.lib
];
imports = [ typelevel-nix.typelevelShell ];
name = "f1r3fly-shell";
typelevelShell = {
jdk.package = holyGraal;
};
env = [
{
name = "LD_LIBRARY_PATH";
value = "${stdenv.cc.cc.lib}/lib:${pkgs.openssl.out}/lib";
}
{
name = "PROTOBUF_LOCATION";
value = "${pkgs.protobuf}";
}
{
name = "PROTOC";
value = "${pkgs.protobuf}/bin/protoc";
}
{
name = "PROTOC_INCLUDE";
value = "${pkgs.protobuf}/include";
}
{
name = "OPENSSL_INCLUDE_DIR";
value = "${pkgs.openssl.dev}/include";
}
{
name = "OPENSSL_LIB_DIR";
value = "${pkgs.openssl.out}/lib";
}
{
name = "BLOOP_JAVA_OPTS";
value = "-Xmx4G -XX:+UseZGC -Xss4m -Xms1g";
}
];
};
}
);
}