Skip to content

Commit

Permalink
Make cargo run work within nix-shell
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Nov 23, 2023
1 parent b95253a commit 6cfc8f6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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}";
}

0 comments on commit 6cfc8f6

Please sign in to comment.