Skip to content

Commit

Permalink
fix flake
Browse files Browse the repository at this point in the history
  • Loading branch information
goodlyrottenapple committed Oct 31, 2023
1 parent f362553 commit a9d9c08
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 150 deletions.
133 changes: 23 additions & 110 deletions flake.lock

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

83 changes: 43 additions & 40 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,33 @@
inputs = {
kevm.url = "github:runtimeverification/evm-semantics/v1.0.332";
nixpkgs.follows = "kevm/nixpkgs";
nixpkgs-pyk.follows = "kevm/nixpkgs-pyk";
k-framework.follows = "kevm/k-framework";
k-framework.inputs.nixpkgs.follows = "nixpkgs";
flake-utils.follows = "kevm/flake-utils";
rv-utils.url = "github:runtimeverification/rv-nix-tools";
rv-utils.follows = "kevm/rv-utils";
pyk.follows = "kevm/pyk";
pyk.inputs.flake-utils.follows = "k-framework/flake-utils";
pyk.inputs.nixpkgs.follows = "k-framework/nixpkgs";
poetry2nix.follows = "kevm/poetry2nix";
foundry.url =
"github:shazow/foundry.nix/monthly"; # Use monthly branch for permanent releases
solc = {
url = "github:hellwolf/solc.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
foundry.follows = "kevm/foundry";
solc.follows = "kevm/solc";
};
outputs = { self, k-framework, nixpkgs, flake-utils, poetry2nix, kevm
, rv-utils, pyk, foundry, solc }:
, rv-utils, pyk, foundry, solc, ... }@inputs:
let
nixLibs = pkgs:
with pkgs;
"-I${procps}/include -L${procps}/lib -I${openssl.dev}/include -L${openssl.out}/lib";
overlay = final: prev:
let
nixpkgs-pyk = import inputs.nixpkgs-pyk {
system = prev.system;
overlays = [ pyk.overlay ];
};
poetry2nix =
inputs.poetry2nix.lib.mkPoetry2Nix { pkgs = nixpkgs-pyk; };

kontrol-pyk = { solc_version ? null }:
(prev.poetry2nix.mkPoetryApplication {
python = prev.python310;
(poetry2nix.mkPoetryApplication {
python = nixpkgs-pyk.python310;
projectDir = ./.;

postPatch = ''
Expand All @@ -41,9 +42,9 @@
--replace ', subdirectory = "kevm-pyk"' ""
'';

overrides = prev.poetry2nix.overrides.withDefaults
overrides = poetry2nix.overrides.withDefaults
(finalPython: prevPython: {
pyk = prev.pyk-python310;
pyk = nixpkgs-pyk.pyk-python310;
kevm-pyk = prev.kevm-pyk;
xdg-base-dirs = prevPython.xdg-base-dirs.overridePythonAttrs
(old: {
Expand All @@ -64,9 +65,15 @@
autoconf
automake
cmake
(kevm-pyk.overridePythonAttrs (old: {
# This is somewhat hacky but it's only a build time dependency.
# We basically override kevm-pyk to add kontrol as a runtime dependency
# so that kevm-dist finds the foundryx target.
(prev.kevm-pyk.overridePythonAttrs (old: {
propagatedBuildInputs = (old.propagatedBuildInputs or [ ])
++ [ (kontrol-pyk { inherit solc_version; }) ];
++ [
((kontrol-pyk { inherit solc_version; }).overrideAttrs
(oldAttrs: { propagatedBuildInputs = [ ]; }))
];
}))
k-framework.packages.${prev.system}.k
libtool
Expand All @@ -89,27 +96,25 @@
} kevm-dist build -j4 foundryx
'';

installPhase =
let kevm = prev.kevm k-framework.packages.${prev.system}.k;
in ''
mkdir -p $out
cp -r ./kdist-*/* $out/
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
'';
installPhase = ''
mkdir -p $out
cp -r ./kdist-*/* $out/
ln -s ${prev.kevm}/haskell $out/haskell
ln -s ${prev.kevm}/haskell-standalone $out/haskell-standalone
ln -s ${prev.kevm}/llvm $out/llvm
ln -s ${prev.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
Expand All @@ -130,8 +135,6 @@
overlays = [
(final: prev: { llvm-backend-release = false; })
k-framework.overlay
poetry2nix.overlay
pyk.overlay
foundry.overlay
solc.overlay
kevm.overlays.default
Expand Down

0 comments on commit a9d9c08

Please sign in to comment.