mirror of
https://github.com/nix-community/nix-ld.git
synced 2025-12-31 01:41:01 +02:00
1
Using with docker images
Wojtek Czekalski edited this page 2023-09-05 20:22:42 +02:00
Adding nix-ld to docker images allows you to run pre-compiled binaries that depend on dynamic libraries inside docker images. To achieve that:
- Add
pkgs.nix-ldto your docker image - Set Env in the image like so:
"NIX_LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath [ pkgs.stdenv.cc ]}"
''NIX_LD=${pkgs.lib.fileContents "${pkgs.stdenv.cc}/nix-support/dynamic-linker"}''
- add
runAsRoot = ''
mkdir /lib64
ln -s /libexec/nix-ld /lib64/$(basename $(< ${pkgs.stdenv.cc}/nix-support/dynamic-linker))
'';