-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathflake.nix
More file actions
100 lines (89 loc) · 2.91 KB
/
flake.nix
File metadata and controls
100 lines (89 loc) · 2.91 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
{
description = "WCN dev environment";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{ self
, nixpkgs
, fenix
, flake-utils
, ...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true; # terraform is no longer free
overlays = [ fenix.overlays.default ];
};
fenixPackages = fenix.packages."${system}";
nativeBuildInputs = with pkgs; [
pkg-config
openssl
clang
libclang
gcc13 # jemalloc fails to build on gcc14 (in debug builds)
rocksdb
];
rustc = {
stable = fenixPackages.stable.rustc;
nightly = fenixPackages.minimal.rustc;
};
cargo = {
stable = fenixPackages.stable.cargo;
nightly = fenixPackages.minimal.cargo;
};
rust-std = {
stable = fenixPackages.stable.rust-std;
nightly = fenixPackages.minimal.rust-std;
};
rust-src = fenixPackages.stable.rust-src;
rustfmt = fenixPackages.default.rustfmt;
clippy = fenixPackages.default.clippy;
in
{
devShells.default = pkgs.mkShell {
inherit nativeBuildInputs;
RUST_SRC_PATH = "${rust-src}/bin/rust-lib/src";
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath nativeBuildInputs;
# Use the dyn library for local development to improve build times.
# Name of this var is defined here https://github.com/rust-rocksdb/rust-rocksdb/blob/master/librocksdb-sys/build.rs
ROCKSDB_LIB_DIR = "${pkgs.rocksdb}/lib";
NIX_LDFLAGS = "${pkgs.lib.optionalString pkgs.stdenv.isDarwin "\
-F${pkgs.darwin.apple_sdk.frameworks.Security}/Library/Frameworks -framework Security \
-F${pkgs.darwin.apple_sdk.frameworks.CoreFoundation}/Library/Frameworks -framework CoreFoundation"}";
buildInputs = with pkgs; [
(fenixPackages.combine [ cargo.stable rustc.stable rust-std.stable rust-src rustfmt ])
(writeShellApplication {
name = "cargo-nightly";
runtimeInputs = [ cargo.nightly rustc.nightly rust-std.nightly clippy ];
text = ''cargo "$@"'';
})
(writeShellApplication {
name = "nu-env";
text = ''
# shellcheck disable=SC1091
. ./env.sh "$1"
exec nu
'';
})
fenixPackages.rust-analyzer
cargo-udeps
docker-compose
solc
foundry
terraform
sops
jq
];
};
}
);
}