Skip to content

Commit

Permalink
fix(evm): solc static binaries for all platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
hussein-aitlahcen committed Oct 17, 2024
1 parent 1b2dc0a commit 58f73f6
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 39 deletions.
2 changes: 1 addition & 1 deletion evm/evm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ _: {
compilers = pkgs.linkFarm "evm-libraries" [
{
name = ".svm/${pkgs.solc.version}/solc-${pkgs.solc.version}";
path = "${pkgs.solc}/bin/solc";
path = "${pkgs.lib.getExe pkgs.solc}";
}
];
wrappedForge = pkgs.symlinkJoin {
Expand Down
68 changes: 68 additions & 0 deletions flake.lock

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

47 changes: 9 additions & 38 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
description = "Union is a trust-minimized, zero-knowledge bridging protocol, designed for censorship resistance, extremely high security and usage in decentralized finance.";
inputs = {
solc = {
url = "github:hellwolf/solc.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "github:NixOS/nixpkgs?rev=75a5ebf473cd60148ba9aec0d219f72e5cf52519";
# Track a separate nixpkgs for latest solc
nixpkgs-solc.url = "github:NixOS/nixpkgs/nixos-unstable";
Expand Down Expand Up @@ -169,6 +173,7 @@
googleapis,
get-flake,
wasmd,
solc,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
Expand Down Expand Up @@ -307,9 +312,12 @@
pkgs = nixpkgs.legacyPackages.${system}.appendOverlays (
with inputs;
[
solc.overlay
rust-overlay.overlays.default
foundry.overlay
(_: super: {
inherit (self'.packages) devnet-utils;

go-ethereum = super.go-ethereum.override {
buildGoModule =
args:
Expand Down Expand Up @@ -346,44 +354,7 @@
pkgs = super;
};

inherit (self'.packages) devnet-utils;
solc =
if system == "aarch64-linux" then
nixpkgs-solc.legacyPackages.${system}.solc.overrideAttrs (
old:
old
// rec {
version = "0.8.27";
src = pkgs.fetchzip {
url = "https://github.com/ethereum/solidity/releases/download/v${version}/solidity_${version}.tar.gz";
sha256 = "sha256-koyoS/MsKpDECtVZ56bkQ6oUOft79HTJl/LZobGLmSk=";
};
postPatch = "";
}
)
else
super.stdenv.mkDerivation rec {
pname = "solc-static";
version = "0.8.27";
src = pkgs.fetchurl {
url = "https://github.com/ethereum/solidity/releases/download/v${version}/solc-static-linux";
hash = "sha256-uZd9UAwXy6bwAyypOe+YxN7PY2PxnzhtBfsC9wgRUmQ=";
};
dontUnpack = true;
nativeBuildInputs = pkgs.lib.optionals (!super.stdenv.isDarwin) [ super.autoPatchelfHook ];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp ${src} $out/bin/solc
chmod +x $out/bin/solc
runHook postInstall
'';
meta = {
description = "Static binary of compiler for Ethereum smart contract language Solidity";
homepage = "https://github.com/ethereum/solidity";
license = super.lib.licenses.gpl3;
};
};
solc = super.solc_0_8_27;
})
]
);
Expand Down

0 comments on commit 58f73f6

Please sign in to comment.