Skip to content

Commit

Permalink
Fix kup version of kontrol by building the foundryx target (#138)
Browse files Browse the repository at this point in the history
* Fix kontrol by building the foundryx target

* Set Version: 0.1.39

* Set Version: 0.1.40

---------

Co-authored-by: devops <devops@runtimeverification.com>
Co-authored-by: rv-jenkins <admin@runtimeverification.com>
  • Loading branch information
3 people authored Oct 27, 2023
1 parent abfdeef commit 51a85d6
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 21 deletions.
80 changes: 62 additions & 18 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"-I${procps}/include -L${procps}/lib -I${openssl.dev}/include -L${openssl.out}/lib";
overlay = final: prev:
let
kontrol = { solc_version ? null }:
kontrol-pyk = { solc_version ? null }:
(prev.poetry2nix.mkPoetryApplication {
python = prev.python310;
projectDir = ./.;
Expand All @@ -54,26 +54,70 @@
groups = [ ];
# We remove `"dev"` from `checkGroups`, so that poetry2nix does not try to resolve dev dependencies.
checkGroups = [ ];
});

kontrol = { solc_version ? null }:
prev.stdenv.mkDerivation {
pname = "kontrol";
version = self.rev or "dirty";
buildInputs = with prev; [
autoconf
automake
cmake
(kevm-pyk.overridePythonAttrs (old: {
propagatedBuildInputs = (old.propagatedBuildInputs or [ ])
++ [ (kontrol-pyk { inherit solc_version; }) ];
}))
k-framework.packages.${prev.system}.k
libtool
openssl.dev
gmp
];
nativeBuildInputs = [ prev.makeWrapper ];

src = ./.;

postInstall = ''
wrapProgram $out/bin/kontrol --prefix PATH : ${
prev.lib.makeBinPath
([ prev.which k-framework.packages.${prev.system}.k ]
++ prev.lib.optionals (solc_version != null) [
final.foundry-bin
(solc.mkDefault final solc_version)
])
} --set NIX_LIBS "${nixLibs prev}" --set KEVM_DIST_DIR ${
prev.kevm k-framework.packages.${prev.system}.k
}
dontUseCmakeConfigure = true;

enableParallelBuilding = true;

buildPhase = ''
XDG_CACHE_HOME=$(pwd) NIX_LIBS="${nixLibs prev}" ${
prev.lib.optionalString
(prev.stdenv.isAarch64 && prev.stdenv.isDarwin)
"APPLE_SILICON=true"
} kevm-dist build -j4 foundryx
'';
}).overrideAttrs (old: {
passthru = old.passthru // (if solc_version == null then {

installPhase =
let kevm = prev.kevm k-framework.packages.${prev.system}.k;
in ''
mkdir -p $out
cp -r ./kdist-*/* $out/
ln -s ${kevm}/foundry $out/foundry
ln -s ${kevm}/haskell $out/haskell
ln -s ${kevm}/haskell-standalone $out/haskell-standalone
ln -s ${kevm}/llvm $out/llvm
ln -s ${kevm}/plugin $out/plugin
mkdir -p $out/bin
makeWrapper ${
(kontrol-pyk { inherit solc_version; })
}/bin/kontrol $out/bin/kontrol --prefix PATH : ${
prev.lib.makeBinPath
([ prev.which k-framework.packages.${prev.system}.k ]
++ prev.lib.optionals (solc_version != null) [
final.foundry-bin
(solc.mkDefault final solc_version)
])
} --set NIX_LIBS "${nixLibs prev}" --set KEVM_DIST_DIR $out
'';

passthru = if solc_version == null then {
# list all supported solc versions here
solc_0_8_13 = kontrol { solc_version = final.solc_0_8_13; };
} else
{ });
});
{ };
};
in { inherit kontrol; };
in flake-utils.lib.eachSystem [
"x86_64-linux"
Expand All @@ -96,9 +140,9 @@
];
};
in {
packages = rec {
packages = {
kontrol = pkgs.kontrol { };
default = self.kontrol;
default = pkgs.kontrol { };
};
}) // {
overlays.default = overlay;
Expand Down
2 changes: 1 addition & 1 deletion package/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.39
0.1.40
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "kontrol"
version = "0.1.39"
version = "0.1.40"
description = "Foundry integration for KEVM"
authors = [
"Runtime Verification, Inc. <contact@runtimeverification.com>",
Expand Down
2 changes: 1 addition & 1 deletion src/kontrol/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
if TYPE_CHECKING:
from typing import Final

VERSION: Final = '0.1.39'
VERSION: Final = '0.1.40'

0 comments on commit 51a85d6

Please sign in to comment.