Make `cargo run` work within `nix-shell`

This commit is contained in:
Hanno Braun 2023-11-23 17:38:51 +01:00
parent b95253ac4d
commit 6cfc8f6ed7
1 changed files with 9 additions and 1 deletions

View File

@ -7,6 +7,14 @@
{ pkgs ? import <nixpkgs> { } }:
let
# `cargo run -p <some-model>` 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}";
}