Skip to content

Commit 29fb17b

Browse files
galin-sSyndamia
authored andcommitted
config(packages): Switch from rust-overlay to fenix
1 parent 925db50 commit 29fb17b

File tree

10 files changed

+90
-155
lines changed

10 files changed

+90
-155
lines changed

flake.lock

Lines changed: 0 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,6 @@
2828
ethereum_nix.follows = "nixos-modules/ethereum-nix";
2929
treefmt-nix.follows = "nixos-modules/treefmt-nix";
3030
devenv.follows = "nixos-modules/devenv";
31-
32-
rust-overlay = {
33-
url = "github:oxalica/rust-overlay";
34-
inputs.nixpkgs.follows = "nixpkgs";
35-
};
36-
37-
rust-overlay-2024-08-01 = {
38-
url = "github:oxalica/rust-overlay?ref=snapshot/2024-08-01";
39-
inputs.nixpkgs.follows = "nixpkgs";
40-
};
4131
};
4232

4333
outputs =

packages/all-packages.nix

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
{
55
pkgs,
66
self',
7+
inputs',
78
...
89
}:
910
let
@@ -17,12 +18,11 @@
1718
inherit (pkgs.lib) optionalAttrs callPackageWith;
1819
inherit (self'.legacyPackages)
1920
rustPlatformStable
20-
craneLib-stable
21-
craneLib-nightly
21+
craneLib
22+
craneLib-fenix-stable
23+
craneLib-fenix-latest
2224
cardano-node
2325
cardano-cli
24-
pkgs-with-rust-overlay
25-
rust-bin-2024-08-01
2626
;
2727
python3Packages = pkgs.python3Packages;
2828

@@ -95,7 +95,7 @@
9595
cardano = callPackage ./cardano/default.nix { inherit cardano-cli cardano-node graphql; };
9696

9797
polkadot-generic = callPackage ./polkadot/default.nix {
98-
craneLib = craneLib-stable;
98+
craneLib = craneLib-fenix-stable;
9999
inherit (darwin) libiconv;
100100
inherit (darwinPkgs)
101101
CoreFoundation
@@ -106,19 +106,6 @@
106106
polkadot = polkadot-generic { };
107107
polkadot-fast = polkadot-generic { enableFastRuntime = true; };
108108

109-
fetchGitHubFile =
110-
{
111-
owner,
112-
repo,
113-
rev,
114-
file,
115-
hash,
116-
}:
117-
pkgs.fetchurl {
118-
url = "https://raw.githubusercontent.com/${owner}/${repo}/${rev}/${file}";
119-
inherit hash;
120-
};
121-
122109
fetchGitHubReleaseAsset =
123110
{
124111
owner,
@@ -153,11 +140,9 @@
153140
};
154141

155142
args-zkVM = {
156-
inherit (pkgs-with-rust-overlay) rust-bin;
157-
inherit craneLib-nightly;
158-
inherit fetchGitHubFile;
143+
rustFromToolchainFile = inputs'.fenix.packages.fromToolchainFile;
144+
inherit craneLib;
159145
inherit installSourceAndCargo;
160-
inherit rust-bin-2024-08-01;
161146
};
162147

163148
args-zkVM-rust = {
@@ -172,8 +157,8 @@
172157
blst = callPackage ./blst { };
173158
bnb-beacon-node = callPackage ./bnb-beacon-node { };
174159

175-
circom = callPackage ./circom/default.nix { craneLib = craneLib-stable; };
176-
circ = callPackage ./circ/default.nix { craneLib = craneLib-stable; };
160+
circom = callPackage ./circom/default.nix { craneLib = craneLib-fenix-stable; };
161+
circ = callPackage ./circ/default.nix { craneLib = craneLib-fenix-stable; };
177162

178163
emscripten = pkgs.emscripten.overrideAttrs (_old: {
179164
postInstall = ''

packages/default.nix

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,39 @@
1717
...
1818
}:
1919
let
20-
pkgs-with-rust-overlay =
21-
let
22-
rust-overlay = inputs.rust-overlay.overlays.default;
23-
in
24-
pkgs.extend rust-overlay;
25-
26-
rust-stable = pkgs-with-rust-overlay.rust-bin.stable.latest.default.override {
27-
extensions = [ "rust-src" ];
28-
targets = [
29-
"wasm32-wasip1"
30-
"wasm32-unknown-unknown"
20+
rust-stable =
21+
with inputs'.fenix.packages;
22+
with stable;
23+
combine [
24+
cargo
25+
clippy
26+
rust-analyzer
27+
rust-src
28+
rustc
29+
rustfmt
30+
targets.wasm32-unknown-unknown.stable.rust-std
31+
targets.wasm32-wasip1.stable.rust-std
32+
targets.wasm32-wasip2.stable.rust-std
3133
];
32-
};
33-
rust-nightly = pkgs-with-rust-overlay.rust-bin.nightly.latest.default.override {
34-
extensions = [ "rust-src" ];
35-
targets = [
36-
"wasm32-wasip1"
37-
"wasm32-unknown-unknown"
34+
35+
rust-latest =
36+
with inputs'.fenix.packages;
37+
with latest;
38+
combine [
39+
cargo
40+
clippy
41+
rust-analyzer
42+
rust-src
43+
rustc
44+
rustfmt
45+
targets.wasm32-unknown-unknown.latest.rust-std
46+
targets.wasm32-wasip1.latest.rust-std
47+
targets.wasm32-wasip2.latest.rust-std
3848
];
39-
};
4049

41-
craneLib-stable = (inputs.crane.mkLib pkgs).overrideToolchain rust-stable;
42-
craneLib-nightly = (inputs.crane.mkLib pkgs).overrideToolchain rust-nightly;
50+
craneLib = inputs.crane.mkLib pkgs;
51+
craneLib-fenix-stable = craneLib.overrideToolchain rust-stable;
52+
craneLib-fenix-latest = craneLib.overrideToolchain rust-latest;
4353

4454
cardano-node = builtins.getFlake "github:input-output-hk/cardano-node/f0b4ac897dcbefba9fa0d247b204a24543cf55f6";
4555

@@ -86,21 +96,19 @@
8696

8797
inherit
8898
rust-stable
89-
rust-nightly
90-
craneLib-stable
91-
craneLib-nightly
92-
pkgs-with-rust-overlay
99+
rust-latest
100+
craneLib
101+
craneLib-fenix-stable
102+
craneLib-fenix-latest
93103
;
94104

95-
rust-bin-2024-08-01 = inputs.rust-overlay-2024-08-01.lib.mkRustBin { } pkgs;
96-
97105
rustPlatformStable = pkgs.makeRustPlatform {
98106
rustc = rust-stable;
99107
cargo = rust-stable;
100108
};
101109
rustPlatformNightly = pkgs.makeRustPlatform {
102-
rustc = rust-nightly;
103-
cargo = rust-nightly;
110+
rustc = rust-latest;
111+
cargo = rust-latest;
104112
};
105113
};
106114
};

packages/jolt/default.nix

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
2-
rust-bin,
3-
craneLib-nightly,
2+
rustFromToolchainFile,
3+
craneLib,
44
fetchFromGitHub,
5-
fetchGitHubFile,
65
installSourceAndCargo,
76
pkg-config,
87
openssl,
@@ -32,15 +31,15 @@ let
3231
};
3332
};
3433

35-
rust-toolchain = rust-bin.fromRustupToolchainFile (fetchGitHubFile {
36-
inherit (commonArgs.src) owner repo rev;
37-
file = "rust-toolchain.toml";
38-
hash = "sha256-Fyj+Bp/dt3epuTN9kXN+r7Z3gzXYCDrcVEPWTr1sQqk=";
39-
});
40-
craneLib = craneLib-nightly.overrideToolchain rust-toolchain;
41-
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
34+
rust-toolchain = rustFromToolchainFile {
35+
dir = commonArgs.src;
36+
sha256 = "sha256-eRCZskam9/DrpAVsoMyvSY7TLnl0E5gfN8FK4gcgZBo=";
37+
};
38+
39+
crane = craneLib.overrideToolchain rust-toolchain;
40+
cargoArtifacts = crane.buildDepsOnly commonArgs;
4241
in
43-
craneLib.buildPackage (
42+
crane.buildPackage (
4443
commonArgs
4544
// (installSourceAndCargo rust-toolchain)
4645
// rec {

packages/nexus/default.nix

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
rust-bin,
3-
craneLib-nightly,
2+
rustFromToolchainFile,
3+
craneLib,
44
fetchFromGitHub,
55
installSourceAndCargo,
66
pkg-config,
@@ -30,13 +30,14 @@ let
3030
};
3131
};
3232

33-
rust-toolchain = rust-bin.nightly."2025-01-02".default.override {
34-
targets = [ "riscv32i-unknown-none-elf" ];
33+
rust-toolchain = rustFromToolchainFile {
34+
dir = commonArgs.src;
35+
sha256 = "sha256-J0fzDFBqvXT2dqbDdQ71yt2/IKTq4YvQs6QCSkmSdKY=";
3536
};
36-
craneLib = craneLib-nightly.overrideToolchain rust-toolchain;
37-
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
37+
crane = craneLib.overrideToolchain rust-toolchain;
38+
cargoArtifacts = crane.buildDepsOnly commonArgs;
3839
in
39-
craneLib.buildPackage (
40+
crane.buildPackage (
4041
commonArgs
4142
// (installSourceAndCargo rust-toolchain)
4243
// rec {

packages/risc0/default.nix

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
{
22
risc0-rust,
3-
rust-bin,
4-
craneLib-nightly,
3+
rustFromToolchainFile,
4+
craneLib,
55
fetchurl,
66
fetchFromGitHub,
7-
fetchGitHubFile,
87
installSourceAndCargo,
98
autoPatchelfHook,
109
pkg-config,
@@ -43,15 +42,14 @@ let
4342
};
4443
};
4544

46-
rust-toolchain = rust-bin.fromRustupToolchainFile (fetchGitHubFile {
47-
inherit (commonArgs.src) owner repo rev;
48-
file = "rust-toolchain.toml";
49-
hash = "sha256-n7Jr8rkovVQ98/KNvSg9EG9JZmKWD7DTaXTbpDJKA0Q=";
50-
});
51-
craneLib = craneLib-nightly.overrideToolchain rust-toolchain;
52-
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
45+
rust-toolchain = rustFromToolchainFile {
46+
dir = commonArgs.src;
47+
sha256 = "sha256-s1RPtyvDGJaX/BisLT+ifVfuhDT1nZkZ1NcK8sbwELM=";
48+
};
49+
crane = craneLib.overrideToolchain rust-toolchain;
50+
cargoArtifacts = crane.buildDepsOnly commonArgs;
5351
in
54-
craneLib.buildPackage (
52+
crane.buildPackage (
5553
commonArgs
5654
// (installSourceAndCargo rust-toolchain)
5755
// rec {

packages/sp1/default.nix

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
sp1-rust,
3-
craneLib-nightly,
3+
craneLib,
44
fetchFromGitHub,
5-
fetchGitHubFile,
65
installSourceAndCargo,
76
pkg-config,
87
openssl,
@@ -28,10 +27,10 @@ let
2827
};
2928

3029
rust-toolchain = sp1-rust;
31-
craneLib = craneLib-nightly.overrideToolchain rust-toolchain;
32-
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
30+
crane = craneLib.overrideToolchain rust-toolchain;
31+
cargoArtifacts = crane.buildDepsOnly commonArgs;
3332
in
34-
craneLib.buildPackage (
33+
crane.buildPackage (
3534
commonArgs
3635
// (installSourceAndCargo rust-toolchain)
3736
// rec {

packages/zkm/default.nix

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
zkm-rust,
3-
craneLib-nightly,
3+
craneLib,
44
fetchFromGitHub,
55
installSourceAndCargo,
66
fetchzip,
@@ -30,10 +30,10 @@ let
3030
};
3131

3232
rust-toolchain = zkm-rust;
33-
craneLib = craneLib-nightly.overrideToolchain rust-toolchain;
34-
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
33+
crane = craneLib.overrideToolchain rust-toolchain;
34+
cargoArtifacts = crane.buildDepsOnly commonArgs;
3535
in
36-
craneLib.buildPackage (
36+
crane.buildPackage (
3737
commonArgs
3838
// (installSourceAndCargo rust-toolchain)
3939
// rec {

0 commit comments

Comments
 (0)