Skip to content

Commit

Permalink
Merge pull request #2108 from hannobraun/nix
Browse files Browse the repository at this point in the history
Make `cargo run` work within `nix-shell`
  • Loading branch information
hannobraun authored Nov 23, 2023
2 parents b95253a + 6cfc8f6 commit 601a2ad
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 601a2ad

Please sign in to comment.