From cbdf166f986879046582e18fe87970a23e3acb2a Mon Sep 17 00:00:00 2001 From: Niklas Korz Date: Sun, 30 Jun 2024 18:23:56 +0200 Subject: [PATCH] Add NixOS shell --- .envrc | 1 + .gitignore | 1 + Cargo.toml | 1 - shell.nix | 28 ++++++++++++++++++++++++++++ src/application.rs | 2 +- 5 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 .envrc create mode 100644 shell.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..65326bb --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use nix \ No newline at end of file diff --git a/.gitignore b/.gitignore index b1b12e6..283fccd 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ /public/linon.js .DS_Store +.direnv/ diff --git a/Cargo.toml b/Cargo.toml index 44be166..6e2cfcb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,4 +42,3 @@ getrandom = { version = "0.2", features = ["js"] } egui = { git = "https://github.com/emilk/egui.git", rev = "ded8dbd45bc8616475c364878f6b8e2f7293d12c" } egui-wgpu = { git = "https://github.com/emilk/egui.git", rev = "ded8dbd45bc8616475c364878f6b8e2f7293d12c" } egui-winit = { git = "https://github.com/emilk/egui.git", rev = "ded8dbd45bc8616475c364878f6b8e2f7293d12c" } -#ac-ffmpeg = { path = "../../rust-ac-ffmpeg" } diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..b82b2ac --- /dev/null +++ b/shell.nix @@ -0,0 +1,28 @@ +# Based on https://github.com/gfx-rs/wgpu/blob/trunk/shell.nix + +{ pkgs ? import { } }: + +pkgs.mkShell rec { + buildInputs = with pkgs; [ + libxkbcommon + wayland + xorg.libX11 + xorg.libXcursor + xorg.libXrandr + xorg.libXi + pkg-config + cmake + + libGL + vulkan-headers + vulkan-loader + vulkan-tools + vulkan-tools-lunarg + vulkan-extension-layer + vulkan-validation-layers + ]; + + shellHook = '' + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${builtins.toString (pkgs.lib.makeLibraryPath buildInputs)}"; + ''; +} diff --git a/src/application.rs b/src/application.rs index b40da8c..7666de2 100644 --- a/src/application.rs +++ b/src/application.rs @@ -59,7 +59,7 @@ impl<'a> Application<'a> { pub async fn new(window: &'a Window) -> Result { let size = window.inner_size(); let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { - backends: wgpu::Backends::PRIMARY, + backends: wgpu::Backends::all(), ..Default::default() }); let surface = instance.create_surface(window)?;