Skip to content

Commit

Permalink
foundry: init at nightly-0688b5a (#457)
Browse files Browse the repository at this point in the history
This introduces a new built-from-source `foundry` package and renames
the old binary package from the `foundry.nix` repo to `foundry-bin`
following the nixpkgs convention.
  • Loading branch information
mitchmindtree authored Feb 7, 2024
1 parent 02dc62f commit 24d141d
Show file tree
Hide file tree
Showing 6 changed files with 2,362 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/update-packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
# TODO: remove nethermind after we fix build for them
# TODO: remove mev-boost after they make a new release tag
blacklist: "staking-deposit-cli,dreamboat,bls,blst,evmc,mcl,besu,teku,docs,foundry,web3signer,mev-boost-prysm,vscode-plugin-consensys-vscode-solidity-visual-editor,vscode-plugin-ackee-blockchain-solidity-tools,mev-boost,nethermind"
blacklist: "staking-deposit-cli,dreamboat,bls,blst,evmc,mcl,besu,teku,docs,foundry-bin,web3signer,mev-boost-prysm,vscode-plugin-consensys-vscode-solidity-visual-editor,vscode-plugin-ackee-blockchain-solidity-tools,mev-boost,nethermind"
sign-commits: true
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
Expand Down
3 changes: 2 additions & 1 deletion packages/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
zcli = callPackage ./utils/zcli {};

# Dev
foundry = inputs.foundry-nix.defaultPackage.${system}.overrideAttrs (_oldAttrs: {
foundry = callPackageUnstable ./dev/foundry {};
foundry-bin = inputs.foundry-nix.defaultPackage.${system}.overrideAttrs (_oldAttrs: {
# TODO: Uncomment when https://github.com/shazow/foundry.nix/issues/23
# meta.platforms = [system];
meta.platforms = ["x86_64-linux" "aarch64-linux"];
Expand Down
81 changes: 81 additions & 0 deletions packages/dev/foundry/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
lib,
stdenv,
darwin,
fetchFromGitHub,
installShellFiles,
libusb1,
pkg-config,
rustPlatform,
}:
rustPlatform.buildRustPackage rec {
pname = "foundry";
version = "nightly-${builtins.substring 0 7 src.rev}";

src = fetchFromGitHub {
owner = "foundry-rs";
repo = "foundry";
rev = "0688b5ad19a637303c038d1a66aec62a73713e20";
hash = "sha256-OIsUzJVNcb2nVCYU/BdGGGICEg9Cr9LXc8zzN2JSb8g=";
};

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=";
};
};

env = {
# Make svm-rs use local release list rather than fetching from non-reproducible URL.
# Run the `update-svm-lists.sh` script to update these lists.
SVM_RELEASES_LIST_JSON =
if stdenv.isDarwin
then "${./svm-lists/macosx-amd64.json}"
else "${./svm-lists/linux-amd64.json}";
};

nativeBuildInputs =
[
installShellFiles
pkg-config
]
++ lib.optionals stdenv.isDarwin [
darwin.DarwinTools
];

buildInputs = lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.AppKit
libusb1
];

postInstall = let
binsWithCompletions = ["anvil" "cast" "forge"];
in ''
${lib.concatMapStringsSep "\n" (bin: ''
installShellCompletion --cmd ${bin} \
--bash <($out/bin/${bin} completions bash) \
--fish <($out/bin/${bin} completions fish) \
--zsh <($out/bin/${bin} completions zsh)
'')
binsWithCompletions}
'';

# Tests are run upstream, and many perform I/O
# incompatible with the nix build sandbox.
doCheck = false;

meta = with lib; {
description = "A portable, 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];
# 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"];
};
}
Loading

0 comments on commit 24d141d

Please sign in to comment.