File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ use flake
Original file line number Diff line number Diff line change @@ -42,3 +42,9 @@ compressed_texture_cache
4242
4343# Generated by "examples/dev_tools/schedule_data.rs"
4444** /app_data.ron
45+
46+ # Generated by direnv
47+ .direnv
48+
49+ # Generated by Visual Studio Code
50+ .vscode
Original file line number Diff line number Diff line change @@ -104,73 +104,14 @@ sudo xbps-install -S pkgconf alsa-lib-devel libX11-devel eudev-libudev-devel
104104
105105### flake.nix
106106
107- Add a ` flake.nix ` file to the root of your GitHub repository containing:
107+ There is a ` flake.nix ` file to the root of this repository. So you can just do
108108
109- ``` nix
110- {
111- description = "bevy flake";
112-
113- inputs = {
114- nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
115- rust-overlay.url = "github:oxalica/rust-overlay";
116- flake-utils.url = "github:numtide/flake-utils";
117- };
118-
119- outputs =
120- {
121- nixpkgs,
122- rust-overlay,
123- flake-utils,
124- ...
125- }:
126- flake-utils.lib.eachDefaultSystem (
127- system:
128- let
129- overlays = [ (import rust-overlay) ];
130- pkgs = import nixpkgs {
131- inherit system overlays;
132- };
133- in
134- {
135- devShells.default =
136- with pkgs;
137- mkShell {
138- buildInputs =
139- [
140- # Rust dependencies
141- (rust-bin.stable.latest.default.override { extensions = [ "rust-src" ]; })
142- pkg-config
143- ]
144- ++ lib.optionals (lib.strings.hasInfix "linux" system) [
145- # for Linux
146- # Audio (Linux only)
147- alsa-lib
148- # Cross Platform 3D Graphics API
149- vulkan-loader
150- # For debugging around vulkan
151- vulkan-tools
152- # Other dependencies
153- libudev-zero
154- libx11
155- libxcursor
156- libxi
157- libxrandr
158- libxkbcommon
159- wayland
160- ];
161- RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
162- LD_LIBRARY_PATH = lib.makeLibraryPath [
163- vulkan-loader
164- libx11
165- libxi
166- libxcursor
167- libxkbcommon
168- wayland
169- ];
170- };
171- }
172- );
173- }
109+ ``` bash
110+ nix develop
111+ ```
112+ If you have ` direnv ` installed as well you just need to allow it for this repo.
113+ ``` bash
114+ direnv allow
174115```
175116
176117> [ !TIP]
Original file line number Diff line number Diff line change 1+ {
2+ description = "Bevy development environment flake" ;
3+
4+ inputs = {
5+ nixpkgs . url = "github:NixOS/nixpkgs/nixos-unstable" ;
6+ rust-overlay . url = "github:oxalica/rust-overlay" ;
7+ flake-utils . url = "github:numtide/flake-utils" ;
8+ } ;
9+
10+ outputs =
11+ {
12+ nixpkgs ,
13+ flake-utils ,
14+ rust-overlay ,
15+ ...
16+ } :
17+ flake-utils . lib . eachDefaultSystem (
18+ system :
19+ let
20+ pkgs = import nixpkgs {
21+ inherit system ;
22+ overlays = [ ( import rust-overlay ) ] ;
23+ } ;
24+
25+ bevyDeps =
26+ with pkgs ;
27+ [
28+ pkg-config
29+ ( rust-bin . stable . latest . default . override {
30+ extensions = [
31+ "rust-src"
32+ "rust-analyzer"
33+ ] ;
34+ } )
35+ ]
36+ ++ lib . optionals stdenv . isLinux (
37+ with pkgs ;
38+ [
39+ # Systembundles & Linkers
40+ lld
41+ clang
42+
43+ # Audio
44+ alsa-lib
45+
46+ # Graphics / Windowing
47+ vulkan-loader
48+ vulkan-tools
49+ wayland
50+ libx11
51+ libxcursor
52+ libxi
53+ libxrandr
54+ libxkbcommon
55+
56+ # Input / Hardware
57+ libudev-zero
58+ ]
59+ ) ;
60+
61+ # Runtime libs for dlopen
62+ runtimeLibs = with pkgs ; [
63+ vulkan-loader
64+ alsa-lib
65+ libx11
66+ libxcursor
67+ libxi
68+ libxrandr
69+ libxkbcommon
70+ wayland
71+ libudev-zero
72+ ] ;
73+ in
74+ {
75+ devShells . default = pkgs . mkShell {
76+ nativeBuildInputs = bevyDeps ;
77+
78+ # Make Winit en Bevy find necessary libraries on Linux
79+ LD_LIBRARY_PATH = pkgs . lib . optionalString pkgs . stdenv . isLinux (
80+ pkgs . lib . makeLibraryPath runtimeLibs
81+ ) ;
82+ } ;
83+ }
84+ ) ;
85+ }
You can’t perform that action at this time.
0 commit comments