From 846daca533422822582a36749d487cba3ae92dd3 Mon Sep 17 00:00:00 2001 From: Minghong Xu Date: Fri, 12 Jan 2024 15:41:22 +0000 Subject: [PATCH] build(flake): add workaround for enabling CUDA on non-NixOS systems Bibliography: - https://discourse.nixos.org/t/on-nixpkgs-and-the-ai-follow-up-to-2023-nix-developer-dialogues/37087 - https://nixos.org/community/teams/cuda - https://github.com/orgs/NixOS/projects/27 - https://alternativebit.fr/posts/nixos/nix-opengl-and-ubuntu-integration-nightmare - https://lobste.rs/s/7h20zl/nix_opengl_ubuntu_integration_nightmare - https://github.com/NixOS/nixpkgs/issues/11390#issuecomment-1093760538 - https://github.com/NixOS/nixpkgs/pull/269475 - https://github.com/tweag/nix-hour/issues/61 --- flake.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 0d7f444..08d6045 100644 --- a/flake.nix +++ b/flake.nix @@ -32,8 +32,14 @@ postShellHook = '' ''; - # Enable python libraries to discover libstdc++.so.6 - LD_LIBRARY_PATH = with pkgs; lib.makeLibraryPath [ stdenv.cc.cc ]; + LD_LIBRARY_PATH = with pkgs; lib.makeLibraryPath [ + # Enable python libraries to discover libstdc++.so.6 + stdenv.cc.cc + + # FIXME: workaround for finding libcuda.so on non-NixOS systems + "/usr" # General location + "/usr/lib/wsl" # On WSL + ]; }; }); }