From 6cfc8f6ed7e06cd7048d7a221126eb5e0210eb1a Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Thu, 23 Nov 2023 17:38:51 +0100 Subject: [PATCH] Make `cargo run` work within `nix-shell` --- shell.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/shell.nix b/shell.nix index 61d4ed176..1288b7ce3 100644 --- a/shell.nix +++ b/shell.nix @@ -7,6 +7,14 @@ { pkgs ? import { } }: +let + # `cargo run -p ` won't work without these libraries on the path. + libPath = with pkgs; lib.makeLibraryPath [ + libxkbcommon + vulkan-loader + wayland + ]; +in pkgs.mkShell { packages = with pkgs; [ # Used as a local build tool. @@ -18,5 +26,5 @@ pkgs.mkShell { ]; # Otherwise `export-validator` produces an error trying to link `libstdc++`. - LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib"; + LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib:${libPath}"; }