Skip to content

Commit 049c5aa

Browse files
committed
1 parent b045e4d commit 049c5aa

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

flake.nix

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,13 @@
3333
# 0.5.7 is not available on aarch64 darwin so alternatively pick 0.8.5
3434
solc = solc-pkgs.mkDefault pkgs (pkgs.solc_0_5_7 or pkgs.solc_0_8_5);
3535

36-
secp256k1-static = pkgsDeps.secp256k1.overrideAttrs (attrs: {
37-
configureFlags = attrs.configureFlags ++ [ "--enable-static" ];
38-
});
39-
40-
ncurses-static = pkgsDeps.ncurses.override { enableStatic = true; };
41-
4236
dependencies-static = with pkgsDeps; [
4337
(gmp.override { withStatic = true; })
44-
secp256k1-static
38+
(pkgsDeps.secp256k1.overrideAttrs (attrs: {
39+
configureFlags = attrs.configureFlags ++ [ "--enable-static" ];
40+
}))
4541
(libff.override { enableStatic = true; })
46-
ncurses-static
42+
(ncurses.override { enableStatic = true; })
4743
] ++ lib.optionals (!pkgs.stdenv.hostPlatform.isDarwin) [
4844
# darwin provides these
4945
(zlib.override { static = true; shared = false; })
@@ -86,19 +82,12 @@
8682
# be provided in a well known location by macos itself.
8783
echidnaRedistributable = let
8884
grep = "${pkgs.gnugrep}/bin/grep";
89-
perl = "${pkgs.perl}/bin/perl";
9085
otool = "${pkgs.darwin.binutils.bintools}/bin/otool";
9186
install_name_tool = "${pkgs.darwin.binutils.bintools}/bin/install_name_tool";
9287
codesign_allocate = "${pkgs.darwin.binutils.bintools}/bin/codesign_allocate";
9388
codesign = "${pkgs.darwin.sigtool}/bin/codesign";
94-
in if pkgs.stdenv.isLinux
89+
in if pkgs.stdenv.isDarwin
9590
then pkgs.runCommand "echidna-stripNixRefs" {} ''
96-
mkdir -p $out/bin
97-
cp ${pkgs.haskell.lib.dontCheck echidna-static}/bin/echidna $out/bin/
98-
# fix TERMINFO path in ncurses
99-
${perl} -i -pe 's#(${ncurses-static}/share/terminfo)#"/etc/terminfo:/lib/terminfo:/usr/share/terminfo:/usr/lib/terminfo" . "\x0" x (length($1) - 65)#e' $out/bin/echidna
100-
chmod 555 $out/bin/echidna
101-
'' else pkgs.runCommand "echidna-stripNixRefs" {} ''
10291
mkdir -p $out/bin
10392
cp ${pkgs.haskell.lib.dontCheck echidna-static}/bin/echidna $out/bin/
10493
# rewrite /nix/... library paths to point to /usr/lib
@@ -113,8 +102,6 @@
113102
*libz.dylib) ${install_name_tool} -change "$lib" /usr/lib/libz.dylib "$exe" ;;
114103
esac
115104
done
116-
# fix TERMINFO path in ncurses
117-
${perl} -i -pe 's#(${ncurses-static}/share/terminfo)#"/usr/share/terminfo" . "\x0" x (length($1) - 19)#e' $out/bin/echidna
118105
# check that no nix deps remain
119106
nixdeps=$(${otool} -L "$exe" | tail -n +2 | { ${grep} /nix/store -c || test $? = 1; })
120107
if [ ! "$nixdeps" = "0" ]; then
@@ -124,7 +111,7 @@
124111
# re-sign binary
125112
CODESIGN_ALLOCATE=${codesign_allocate} ${codesign} -f -s - "$exe"
126113
chmod 555 "$exe"
127-
'';
114+
'' else echidna-static;
128115

129116
# if we pass a library folder to ghc via --extra-lib-dirs that contains
130117
# only .a files, then ghc will link that library statically instead of

0 commit comments

Comments
 (0)