-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
141 lines (113 loc) · 3.67 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
{
description = "Nix development dependencies for ibc-starknet";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
cairo-nix.url = "github:cairo-nix/cairo-nix";
cosmos-nix.url = "github:informalsystems/cosmos.nix";
starknet-devnet-src = {
url = "github:0xSpaceShard/starknet-devnet-rs";
flake = false;
};
cairo-src = {
url = "github:starkware-libs/cairo/v2.8.4";
flake = false;
};
scarb-src = {
url = "github:software-mansion/scarb/v2.8.4";
flake = false;
};
universal-sierra-compiler-src = {
url = "github:software-mansion/universal-sierra-compiler/v2.3.0";
flake = false;
};
};
outputs =
inputs:
let
utils = inputs.flake-utils.lib;
in
utils.eachSystem
[
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
"x86_64-linux"
]
(
system:
let
nixpkgs = import inputs.nixpkgs {
inherit system;
overlays = [ inputs.rust-overlay.overlays.default ];
};
cosmos-nix = inputs.cosmos-nix.packages.${system};
rust = nixpkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
rust-wasm = nixpkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain-wasm.toml;
rust-nightly = nixpkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain-nightly.toml;
rust-1_79 = nixpkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain-1.79.toml;
wasm-simapp = cosmos-nix.ibc-go-v8-wasm-simapp;
starknet-devnet = import ./nix/starknet-devnet.nix {
inherit nixpkgs;
inherit (inputs) starknet-devnet-src;
rust = rust-1_79;
};
cairo = import ./nix/cairo.nix {
inherit nixpkgs;
inherit (inputs) cairo-src;
};
scarb = import ./nix/scarb.nix {
inherit nixpkgs;
inherit (inputs) scarb-src cairo-src;
};
universal-sierra-compiler = import ./nix/universal-sierra-compiler.nix {
inherit nixpkgs;
inherit (inputs) universal-sierra-compiler-src;
rust = rust-1_79;
};
starknet-pkgs = {
inherit
starknet-devnet
cairo
scarb
universal-sierra-compiler
wasm-simapp
;
};
tools = {
inherit (nixpkgs)
protobuf
cargo-nextest
taplo
just
;
nixfmt = nixpkgs.nixfmt-rfc-style;
};
mac-deps = nixpkgs.lib.optional nixpkgs.stdenv.isDarwin [
nixpkgs.libiconv
nixpkgs.darwin.apple_sdk.frameworks.SystemConfiguration
];
shell-deps = (builtins.attrValues starknet-pkgs) ++ (builtins.attrValues tools) ++ mac-deps;
in
{
packages = {
inherit
starknet-devnet
cairo
scarb
rust
rust-nightly
rust-wasm
;
} // tools // starknet-pkgs;
devShells = {
default = nixpkgs.mkShell { buildInputs = shell-deps; };
rust = nixpkgs.mkShell { buildInputs = [ rust ] ++ shell-deps; };
rust-nightly = nixpkgs.mkShell { buildInputs = [ rust-nightly ] ++ shell-deps; };
rust-wasm = nixpkgs.mkShell { buildInputs = [ rust-wasm ] ++ shell-deps; };
};
formatter = tools.nixfmt;
}
);
}