From 282323dfc1d03284c599deb81b9f31f99470a169 Mon Sep 17 00:00:00 2001 From: Lukas Hermansson Date: Fri, 11 Oct 2024 10:49:36 +0200 Subject: [PATCH] update flake to support the egui packet inspector (#657) # Objective When trying to use the packet inspector I noticed that it could not be ran on nix, the `nix develop` simply does not include the required libraries. # Solution I added dependencies listed for bevy window applications to work: https://github.com/bevyengine/bevy/blob/main/docs/linux_dependencies.md#nix and cleaned up the flake a bit while I was at it. --- flake.nix | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/flake.nix b/flake.nix index c8129f651..dbbb40533 100644 --- a/flake.nix +++ b/flake.nix @@ -8,24 +8,38 @@ flake = false; }; }; - outputs = { self, nixpkgs, flake-utils, rust-overlay, ... }: flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system: let - overlays = [ (import rust-overlay) ]; + overlays = [ (import rust-overlay) ]; pkgs = import nixpkgs { inherit system overlays; }; + + rust = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default); + + appNativeBuildInputs = with pkgs; [ + # required for the packet inspector on nix + pkg-config + ]; + appBuildInputs = with pkgs; [ + rust rust-analyzer + # dependencies for the packet inspector + udev alsa-lib vulkan-loader wayland + xorg.libX11 xorg.libXcursor xorg.libXi xorg.libXrandr + libxkbcommon wayland + ]; in rec { - devShell = pkgs.mkShell { - buildInputs = with pkgs; [ - (rust-bin.selectLatestNightlyWith (toolchain: toolchain.default)) - rust-analyzer - ]; - }; + devShell = pkgs.mkShell { + nativeBuildInputs = appNativeBuildInputs; + buildInputs = appBuildInputs; + shellHook = '' + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.lib.makeLibraryPath appBuildInputs}" + ''; + }; }); }