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:

  1. Add pkgs.nix-ld to your docker image
  2. 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"}''
  1. add
runAsRoot = ''
  mkdir /lib64
  ln -s /libexec/nix-ld /lib64/$(basename  $(< ${pkgs.stdenv.cc}/nix-support/dynamic-linker))
'';