-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy pathflake.nix
189 lines (158 loc) · 5.53 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/f1010e0469db743d14519a1efd37e23f8513d714";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
foundry.url = "github:shazow/foundry.nix/monthly";
crane.url = "github:ipetkov/crane";
crane.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = {
self,
nixpkgs,
rust-overlay,
flake-utils,
foundry,
crane,
...
}:
flake-utils.lib.eachSystem ["aarch64-darwin" "x86_64-darwin" "x86_64-linux" "aarch64-linux"] (
system: let
overrides = (builtins.fromTOML (builtins.readFile ./rust-toolchain.toml));
overlays = [
(import rust-overlay)
foundry.overlay
];
pkgs = import nixpkgs {
inherit system overlays;
};
craneLib = crane.mkLib pkgs;
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
mold
];
sysDependencies = with pkgs; []
++ lib.optionals stdenv.isDarwin [
frameworks.Security
frameworks.CoreServices
frameworks.SystemConfiguration
frameworks.AppKit
] ++ lib.optionals stdenv.isLinux [
udev
systemd
snappy
bzip2
];
testDependencies = with pkgs; [
just
foundry-bin
process-compose
celestia-node
celestia-app
monza-aptos
jq
];
# Specific version of toolchain
rust = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
rustPlatform = pkgs.makeRustPlatform {
cargo = rust;
rustc = rust;
};
# Needs to be removed soon and replaced with aptos-faucet-service
monza-aptos = pkgs.stdenv.mkDerivation {
pname = "monza-aptos";
version = "branch-monza";
src = pkgs.fetchFromGitHub {
owner = "movementlabsxyz";
repo = "aptos-core";
rev = "06443b81f6b8b8742c4aa47eba9e315b5e6502ff";
sha256 = "sha256-iIYGbIh9yPtC6c22+KDi/LgDbxLEMhk4JJMGvweMJ1Q=";
};
installPhase = ''
cp -r . $out
'';
meta = with pkgs.lib; {
description = "Aptos core repository on the monza branch";
homepage = "https://github.com/movementlabsxyz/aptos-core";
license = licenses.asl20;
};
};
# Remember, remove this thing above
# celestia-node
celestia-node = import ./nix/celestia-node.nix { inherit pkgs; };
# celestia-app
celestia-app = import ./nix/celestia-app.nix { inherit pkgs; };
# aptos-faucet-service
aptos-faucet-service = import ./nix/aptos-faucet-service.nix {
inherit pkgs;
commonArgs = {
src = pkgs.fetchFromGitHub {
owner = "movementlabsxyz";
repo = "aptos-core";
rev = "06443b81f6b8b8742c4aa47eba9e315b5e6502ff";
sha256 = "sha256-iIYGbIh9yPtC6c22+KDi/LgDbxLEMhk4JJMGvweMJ1Q=";
};
strictDeps = true;
buildInputs = with pkgs; [] ++buildDependencies ++ sysDependencies;
nativeBuildInputs = with pkgs; [] ++buildDependencies ++sysDependencies;
};
inherit craneLib;
};
in
with pkgs; {
packages.aptos-faucet-service = aptos-faucet-service;
packages.celestia-node = celestia-node;
packages.celestia-app = celestia-app;
# Used for workaround for failing vendor dep builds in nix
devShells.docker-build = mkShell {
buildInputs = [] ++buildDependencies ++sysDependencies;
nativeBuildInputs = [] ++buildDependencies ++sysDependencies;
OPENSSL_DEV=pkgs.openssl.dev;
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
SNAPPY = if stdenv.isLinux then pkgs.snappy else null;
shellHook = ''
#!/usr/bin/env bash
echo "rust-build shell"
'';
};
# Development Shell
devShells.default = mkShell {
ROCKSDB=pkgs.rocksdb;
# for linux set SNAPPY variable
SNAPPY = if stdenv.isLinux then pkgs.snappy else null;
OPENSSL_DEV = pkgs.openssl.dev;
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
MONZA_APTOS_PATH = monza-aptos;
buildInputs = [] ++buildDependencies ++sysDependencies ++testDependencies;
nativeBuildInputs = [] ++buildDependencies ++sysDependencies;
shellHook = ''
#!/bin/bash -e
echo "Monza Aptos path: $MONZA_APTOS_PATH"
cat <<'EOF'
_ _ __ _ _ ____ _ _ ____ __ _ ____
( \/ ) / \ / )( \( __)( \/ )( __)( ( \(_ _)
/ \/ \( O )\ \/ / ) _) / \/ \ ) _) / / )(
\_)(_/ \__/ \__/ (____)\_)(_/(____)\_)__) (__)
EOF
echo "Develop with Move Anywhere"
'';
};
}
);
}