Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

foundry: update to the latest version and fix compilation with recent Nixpkgs version #37

Merged
merged 9 commits into from
Oct 22, 2024
6 changes: 3 additions & 3 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.2.0; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.0/direnvrc" "sha256-5EwyKnkJNQeXrRkYbwwRBcXbibosCJqyIUuz9Xq+LRc="
if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM="
fi
nix_direnv_watch_file ./flake-shell.nix

use flake
97 changes: 75 additions & 22 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
nixpkgs.url = "github:nixos/nixpkgs/24.05";
nixpkgs-2311.url = "github:nixos/nixpkgs/23.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nixpkgs-nethermind.url = "github:nixos/nixpkgs?rev=9c513fc6fb75142f6aec6b7545cb8af2236b80f5";

foundry-nix = {
url = "github:shazow/foundry.nix/monthly";
Expand All @@ -32,7 +33,6 @@
systems.url = "github:nix-systems/default";
devshell = {
url = "github:numtide/devshell";
inputs.flake-utils.follows = "flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
treefmt-nix = {
Expand All @@ -53,6 +53,10 @@
treefmt-nix.follows = "treefmt-nix";
};
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
};

outputs = inputs @ {
Expand Down Expand Up @@ -102,6 +106,10 @@
inherit system;
nixpkgs = inputs.nixpkgs-2311;
};
pkgsNethermind = lib.extras.nix.mkNixpkgs {
inherit system;
nixpkgs = inputs.nixpkgs-nethermind;
};
};

# devshell
Expand Down
28 changes: 19 additions & 9 deletions pkgs/blutgang/default.nix
Original file line number Diff line number Diff line change
@@ -1,34 +1,44 @@
{
lib,
fetchFromGitHub,
openssl,
pkg-config,
rustPlatform,
rust-jemalloc-sys,
stdenv,
darwin,
}:
rustPlatform.buildRustPackage rec {
pname = "blutgang";
version = "0.3.1";
version = "0.3.6";

src = fetchFromGitHub {
owner = "rainshowerLabs";
repo = pname;
rev = "Blutgang-${version}";
hash = "sha256-prJq1enn2bJdJieVjvq1vd7dCNBlg5ppymIwjU4pgzg=";
hash = "sha256-EAmmCvESMneYuoTEa8Qm5eYqJkkRDY8CqlfsER1Pq8s=";
};

cargoHash = "sha256-1G80j/lZrAlrgOLgpKyGYP9x6g/9kxXf3wmY2OcynFc=";

nativeBuildInputs = [
pkg-config
];

buildInputs = [
openssl
];

cargoHash = "sha256-bAHUcfRtefGsRgFMBY5JJ4QSstB8wApcdqz/pqSVpuk=";
buildInputs =
[openssl rust-jemalloc-sys]
++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.SystemConfiguration
];

meta = {
description = "the wd40 of ethereum load balancers";
description = "The wd40 of ethereum load balancers";
homepage = "https://github.com/rainshowerLabs/blutgang";
# Functional Source License, Version 1.0, Apache 2.0 Change License
# https://github.com/rainshowerLabs/blutgang/blob/Blutgang-0.3.6/LICENSE
license = lib.licenses.unfree;
mainProgram = "blutgang";
platforms = ["x86_64-linux"];
platforms = ["x86_64-linux" "aarch64-darwin"];
};
}
14 changes: 12 additions & 2 deletions pkgs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,26 @@

perSystem = {
self',
inputs',
pkgs,
pkgsUnstable,
pkgs2311,
pkgsNethermind,
system,
...
}: let
inherit (pkgs) callPackage;
inherit (lib.extras.flakes) platformPkgs platformApps;
callPackageUnstable = pkgsUnstable.callPackage;
callPackage2311 = pkgs2311.callPackage;
callPackageNethermind = pkgsNethermind.callPackage;

rustToolchain = inputs'.fenix.packages.minimal.toolchain;

rustPlatform = pkgsUnstable.makeRustPlatform {
cargo = rustToolchain;
rustc = rustToolchain;
};
in {
packages = platformPkgs system rec {
besu = callPackageUnstable ./besu {};
Expand All @@ -44,7 +54,7 @@
ethdo = callPackage ./ethdo {inherit bls mcl;};
ethereal = callPackage ./ethereal {inherit bls mcl;};
evmc = callPackage ./evmc {};
foundry = callPackageUnstable ./foundry {};
foundry = callPackageUnstable ./foundry {inherit rustPlatform;};
foundry-bin = inputs.foundry-nix.defaultPackage.${system}.overrideAttrs (_oldAttrs: {
# TODO: Uncomment when https://github.com/shazow/foundry.nix/issues/23
# meta.platforms = [system];
Expand All @@ -59,7 +69,7 @@
mev-boost-builder = callPackage ./mev-boost-builder {inherit blst;};
mev-boost-relay = callPackage ./mev-boost-relay {inherit blst;};
mev-rs = callPackage ./mev-rs {};
nethermind = callPackageUnstable ./nethermind {};
nethermind = callPackageNethermind ./nethermind {};
nimbus = callPackageUnstable ./nimbus {};
nimbus-eth2 = callPackageUnstable ./nimbus-eth2 {
# For now the nimbus team prefers nim 1.6 over 2.0.
Expand Down
21 changes: 7 additions & 14 deletions pkgs/foundry/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,11 @@ rustPlatform.buildRustPackage rec {
src = fetchFromGitHub {
owner = "foundry-rs";
repo = "foundry";
rev = "0688b5ad19a637303c038d1a66aec62a73713e20";
hash = "sha256-OIsUzJVNcb2nVCYU/BdGGGICEg9Cr9LXc8zzN2JSb8g=";
rev = "88e18ef8bb096345ba19165da73c752215d4f19b";
hash = "sha256-H7av+9lLFRGCbzdpAOGXlZGZ2iLu+OfLd2nbvLPqiNQ=";
};

cargoLock = {
lockFile = "${src}/Cargo.lock";
outputHashes = {
"alloy-consensus-0.1.0" = "sha256-rHDLt0N6VIAlg2EKEdF0S2S8XqJebRlIB7owyGQ04aA=";
"ethers-2.0.11" = "sha256-ySrCZOiqOcDVH5T7gbimK6Bu7A2OCcU64ZL1RfFPrBc=";
"revm-3.5.0" = "sha256-gdDJq2ZyIkMhTgMNz45YJXnopF/xxt3CaSd/eYSDGcY=";
"revm-inspectors-0.1.0" = "sha256-mH6On3cjKLT14S+5dxB1G5lcf5PBtz0KcusMxOtRRWA=";
};
};
cargoHash = "sha256-3VEv4lfMBsX/A9xSWgaljBKSFyL0+BF5alsBJ8NtBQ8=";

env = {
# Make svm-rs use local release list rather than fetching from non-reproducible URL.
Expand Down Expand Up @@ -69,13 +61,14 @@ rustPlatform.buildRustPackage rec {
doCheck = false;

meta = with lib; {
description = "A portable, modular toolkit for Ethereum application development written in Rust.";
homepage = "https://github.com/foundry-rs/foundry";
description = "Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust";
homepage = "https://github.com/foundry-rs/foundry/";
license = with licenses; [asl20 mit];
maintainers = with maintainers; [mitchmindtree];
mainProgram = "foundry";
# For now, solc binaries are only built for x86_64.
# Track darwin-aarch64 here:
# https://github.com/ethereum/solidity/issues/12291
platforms = ["x86_64-linux" "x86_64-darwin"];
platforms = ["x86_64-linux" "x86_64-darwin" "aarch64-darwin"];
};
}
Loading