Skip to content

Commit

Permalink
Fix TERMINFO path for Nix release builds on Linux
Browse files Browse the repository at this point in the history
ncurses in Nix is built with a TERMINFO path that references `/nix`.
This causes the binaries fail when ran on non-nix systems, unless
TERMINFO=/usr/share/terminfo is exported. This patches the binaries
to use a more sensible default TERMINFO path.

See also commit f76a7f4
  • Loading branch information
elopez committed Oct 31, 2023
1 parent 693f3c7 commit 8e568bf
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,13 @@
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-static
else pkgs.runCommand "echidna-stripNixRefs" {} ''
then pkgs.runCommand "echidna-stripNixRefs" {} ''
mkdir -p $out/bin
cp ${pkgs.haskell.lib.dontCheck echidna-static}/bin/echidna $out/bin/
# fix TERMINFO path in ncurses
${perl} -i -pe 's#(${pkgs.ncurses}/share/terminfo)#"/usr/share/terminfo" . "\x0" x (length($1) - 19)#e' $out/bin/echidna
chmod 555 $out/bin/echidna
'' else pkgs.runCommand "echidna-stripNixRefs" {} ''
mkdir -p $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
Expand Down

0 comments on commit 8e568bf

Please sign in to comment.