From f91434e99b31294ba2bb13ce2de94472028ab3e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Thu, 13 Mar 2025 14:02:45 +0100 Subject: [PATCH] Make the Nix-based Docker container work on non-NixOS (#3109) On NixOS, the CUDA driver shim gets mounted on /run/opengl-driver, where Nix packages expect the shim to be. However, on other distributions, some FHS paths are mounted. This is a small change to make the dynamic loader find the shim. --- flake.nix | 8 ++++++-- nix/docker.nix | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index ac4331c24..7ddd3b92d 100644 --- a/flake.nix +++ b/flake.nix @@ -176,11 +176,15 @@ ''; }; - dockerImage = pkgs.callPackage nix/docker.nix { + # Use plain nixpkgs without overlays for dockerTools. dockerTools + # uses a Python package for computing the layers from the transitive + # closure. However, this needs a lot of rebuilds due to our overlay. + + dockerImage = nixpkgs.legacyPackages.${system}.callPackage nix/docker.nix { text-generation-inference = default; }; - dockerImageStreamed = pkgs.callPackage nix/docker.nix { + dockerImageStreamed = nixpkgs.legacyPackages.${system}.callPackage nix/docker.nix { text-generation-inference = default; stream = true; }; diff --git a/nix/docker.nix b/nix/docker.nix index dc4c823d2..a8fc256e6 100644 --- a/nix/docker.nix +++ b/nix/docker.nix @@ -18,6 +18,10 @@ build { Env = [ "HF_HOME=/data" "PORT=80" + # The CUDA container toolkit will mount the driver shim into the + # container. We just have to ensure that the dynamic loader finds + # the libraries. + "LD_LIBRARY_PATH=/usr/lib64" ]; };