From 139366b02150ca26ba4b90c3424165f8be266efa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Thu, 26 Oct 2023 10:56:17 -0300 Subject: [PATCH] Unbreak normal nix build --- flake.nix | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/flake.nix b/flake.nix index bd634596d..199935380 100644 --- a/flake.nix +++ b/flake.nix @@ -50,7 +50,7 @@ repo = "hevm"; rev = "release/0.51.3-plus-ghc-9.4-support"; sha256 = "sha256-gJMFYfsPqf5XZyyPDGJLqr9q9RpXkemGeUQUvFT6V0E"; - }) { secp256k1 = secp256k1-static; }); + }) { secp256k1 = pkgs.secp256k1; }); # FIXME: figure out solc situation, it conflicts with the one from # solc-select that is installed with slither, disable tests in the meantime @@ -60,7 +60,12 @@ [ (haskell.lib.compose.addTestToolDepends [ haskellPackages.hpack slither-analyzer solc ]) (haskell.lib.compose.disableCabalFlag "static") - (haskell.lib.compose.appendConfigureFlags ( + ]); + + echidna-static = with pkgs; lib.pipe + echidna + [ + (haskell.lib.compose.appendConfigureFlags [ "--extra-lib-dirs=${stripDylib (pkgs.gmp.override { withStatic = true; })}/lib" "--extra-lib-dirs=${stripDylib secp256k1-static}/lib" @@ -69,8 +74,9 @@ "--extra-lib-dirs=${stripDylib (libiconv.override { enableStatic = true; })}/lib" "--extra-lib-dirs=${stripDylib (libffi.overrideAttrs (_: { dontDisableStatic = true; }))}/lib" "--extra-lib-dirs=${stripDylib (ncurses-static)}/lib" - ])) - ]); + ]) + (haskell.lib.compose.enableCabalFlag "static") + ]; # "static" binary for distribution # on linux this is actually a real fully static binary @@ -82,11 +88,13 @@ perl = "${pkgs.perl}/bin/perl"; otool = "${pkgs.darwin.binutils.bintools}/bin/otool"; install_name_tool = "${pkgs.darwin.binutils.bintools}/bin/install_name_tool"; + codesign_allocate = "${pkgs.darwin.binutils.bintools}/bin/codesign_allocate"; + codesign = "${pkgs.darwin.sigtool}/bin/codesign"; in if pkgs.stdenv.isLinux - then pkgs.haskell.lib.dontCheck echidna + then pkgs.haskell.lib.dontCheck echidna-static else pkgs.runCommand "echidna-stripNixRefs" {} '' mkdir -p $out/bin - cp ${pkgs.haskell.lib.dontCheck echidna}/bin/echidna $out/bin/ + cp ${pkgs.haskell.lib.dontCheck echidna-static}/bin/echidna $out/bin/ # get the list of dynamic libs from otool and tidy the output libs=$(${otool} -L $out/bin/echidna | tail -n +2 | sed 's/^[[:space:]]*//' | cut -d' ' -f1) # get the path for libcxx @@ -96,6 +104,8 @@ ${install_name_tool} -change "$cxx" /usr/lib/libc++.1.dylib $out/bin/echidna # fix TERMINFO path in ncurses ${perl} -i -pe 's#(${ncurses-static}/share/terminfo)#"/usr/share/terminfo" . "\x0" x (length($1) - 19)#e' $out/bin/echidna + # re-sign binary + CODESIGN_ALLOCATE=${codesign_allocate} ${codesign} -f -s - $out/bin/echidna chmod 555 $out/bin/echidna ''; @@ -114,8 +124,7 @@ packages.echidna = echidna; packages.default = echidna; - packages.echidna-bundle = - pkgs.callPackage nix-bundle-exe {} echidnaRedistributable; + packages.echidna-redistributable = echidnaRedistributable; devShell = with pkgs; haskellPackages.shellFor {