Hi all,
I’m trying to write a nix-shell to run a binary, that is using an old unpackaged version of libpcap.
The binary is accepting the symlinked current version of libpcap, so I wanted to setup my nix-shell with just symlinking the shared lib.
shell.nix
with import <nixpkgs> {};
mkShell {
libpcapPatched = pkgs.libpcap.overrideAttrs (oldAttrs: {
postInstall = oldAttrs.postInstall + ''
echo symlinking old libpcap.so.0.8
mkdir -p $out/lib
ln $out/lib/libpcap.so $out/lib/libpcap.so.0.8
echo $out
echo symlinking old libpcap.so.0.8 ... done.
'';}
);
shellHook = ''
echo "Entering shell"
Something like this --> export LD_LIBRARY_PATH=${libpcapPatched.out}/lib:$LD_LIBRARY_PATH
fish
'';
}
If I enter this shell with nix-shell
, the postInstall
hook outputs a nix store path (via the line echo $out
), that includes the symlinked shared library.
If I add this path by hand to the LD_LIBRARY_PATH environment variable, the binary can run.
How can I access the $out
variable of the override libpcap in the shellHook
?
Thanks!