-
Notifications
You must be signed in to change notification settings - Fork 77
/
flake.nix
178 lines (151 loc) · 5.35 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/8dedccea6cea1e65bf74fc6c7f35e0aadf832a14";
rust-overlay.url = "github:oxalica/rust-overlay/db12d0c6ef002f16998723b5dd619fa7b8997086";
flake-utils.url = "github:numtide/flake-utils";
foundry.url = "github:shazow/foundry.nix/f533e2c70e520adb695c9917be21d514c15b1c4d";
crane.url = "github:ipetkov/crane";
crane.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { nixpkgs, rust-overlay, flake-utils, foundry, crane, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) foundry.overlay ];
};
toolchain = p: (p.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml).override {
extensions = [ "rustfmt" "clippy" ];
};
craneLib = (crane.mkLib pkgs).overrideToolchain(toolchain);
frameworks = pkgs.darwin.apple_sdk.frameworks;
buildDependencies = with pkgs; [
llvmPackages.bintools
openssl
openssl.dev
libiconv
pkg-config
libclang.lib
libz
clang
pkg-config
protobuf
rustPlatform.bindgenHook
lld
mold
coreutils
gcc
rust
postgresql
tesseract4
ansible
zlib
fixDarwinDylibNames
];
sysDependencies = with pkgs; []
++ lib.optionals stdenv.isDarwin [
frameworks.Security
frameworks.CoreServices
frameworks.SystemConfiguration
frameworks.AppKit
libelf
] ++ lib.optionals stdenv.isLinux [
udev
systemd
snappy
bzip2
elfutils
];
testDependencies = with pkgs; [
python311
poetry
just
foundry-bin
process-compose
celestia-node
celestia-app
jq
docker
solc
grpcurl
grpcui
];
# Specific version of toolchain
rust = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
rustPlatform = pkgs.makeRustPlatform {
cargo = rust;
rustc = rust;
};
celestia-app = pkgs.buildGoModule {
pname = "celestia-app";
version = "2.3.1";
src = pkgs.fetchgit {
url = "https://github.com/celestiaorg/celestia-app";
rev = "v2.3.1";
hash = "sha256-ui67KRaabQyZiV5QD4Qyaqobky++rAe9ppJ2yveoXOs=";
};
vendorHash = "sha256-zL3G+ml2bIcQlthHY6rovr2ykCGHqV51rQBkS3J9tGo=";
subPackages = [ "cmd/celestia-appd" ];
};
celestia-node = pkgs.buildGoModule {
pname = "celestia-node";
version = "0.17.2";
src = pkgs.fetchgit {
url = "https://github.com/celestiaorg/celestia-node";
rev = "v0.17.2";
hash = "sha256-7Ame5xxLbLgD8LGNNWWqI0uUFO5K6MXvCo9TK9V5Sls=";
};
vendorHash = "sha256-RoydbcJ4A2KTW20ihybnUkROwKlrT69qhl8E+NRgOpk=";
subPackages = [ "cmd/celestia" "cmd/cel-key" ];
};
in {
packages = {
inherit celestia-app celestia-node;
};
devShells = rec {
default = docker-build;
docker-build = pkgs.mkShell {
ROCKSDB = pkgs.rocksdb;
SNAPPY = if pkgs.stdenv.isLinux then pkgs.snappy else null;
OPENSSL_DEV = pkgs.openssl.dev;
buildInputs = with pkgs; [
# rust toolchain
(toolchain pkgs)
# build dependencies
llvmPackages.bintools openssl openssl.dev libiconv pkg-config
libclang.lib libz clang pkg-config protobuf rustPlatform.bindgenHook
lld mold coreutils postgresql
# test dependencies
python311 poetry just foundry-bin process-compose jq docker solc
grpcurl grpcui
celestia-app celestia-node
] ++ lib.optionals stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [
Security CoreServices SystemConfiguration AppKit
]) ++ lib.optionals stdenv.isLinux (with pkgs; [
udev systemd snappy bzip2 elfutils.dev
]);
LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib/";
shellHook = ''
#!/usr/bin/env ${pkgs.bash}
export DOT_MOVEMENT_PATH=$(pwd)/.movement
mkdir -p $DOT_MOVEMENT_PATH
# export PKG_CONFIG_PATH=$PKG_CONFIG_PATH_FOR_TARGET
# Export linker flags if on Darwin (macOS)
if [[ "$(${pkgs.stdenv.hostPlatform.system})" =~ "darwin" ]]; then
export LDFLAGS="-L/opt/homebrew/opt/zlib/lib"
export CPPFLAGS="-I/opt/homebrew/opt/zlib/include"
fi
echo "Monza Aptos path: $MONZA_APTOS_PATH"
cat <<'EOF'
_ _ __ _ _ ____ _ _ ____ __ _ ____
( \/ ) / \ / )( \( __)( \/ )( __)( ( \(_ _)
/ \/ \( O )\ \/ / ) _) / \/ \ ) _) / / )(
\_)(_/ \__/ \__/ (____)\_)(_/(____)\_)__) (__)
EOF
echo "Develop with Move Anywhere"
'';
};
};
}
);
}