mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-01-11 12:30:23 +01:00
feat: add templates for bevy
This commit is contained in:
17
templates/bevy/Justfile
Normal file
17
templates/bevy/Justfile
Normal file
@@ -0,0 +1,17 @@
|
||||
default:
|
||||
@just --list
|
||||
|
||||
# Auto-format the source tree
|
||||
fmt:
|
||||
treefmt
|
||||
|
||||
# Run 'cargo run' on the project
|
||||
drun *ARGS:
|
||||
nix develop --command cargo run {{ARGS}}
|
||||
|
||||
dbuild:
|
||||
nix develop --command cargo build
|
||||
|
||||
# Run 'cargo watch' to run the project (auto-recompiles)
|
||||
watch *ARGS:
|
||||
cargo watch -x "run -- {{ARGS}}"
|
||||
54
templates/bevy/flake.nix
Normal file
54
templates/bevy/flake.nix
Normal file
@@ -0,0 +1,54 @@
|
||||
# https://github.com/bevyengine/bevy/blob/v0.14.2/docs/linux_dependencies.md#nix
|
||||
{
|
||||
description = "Bevy Game Engine - Rust Lang";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = {
|
||||
nixpkgs,
|
||||
rust-overlay,
|
||||
...
|
||||
}: let
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
];
|
||||
# Helper function to generate a set of attributes for each system
|
||||
forAllSystems = func: (nixpkgs.lib.genAttrs systems func);
|
||||
in {
|
||||
devShells = forAllSystems (system: let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [(import rust-overlay)];
|
||||
};
|
||||
lib = pkgs.lib;
|
||||
in {
|
||||
default = pkgs.mkShell rec {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
pkg-config
|
||||
];
|
||||
buildInputs = with pkgs; [
|
||||
udev
|
||||
alsa-lib
|
||||
vulkan-loader
|
||||
xorg.libX11
|
||||
xorg.libXcursor
|
||||
xorg.libXi
|
||||
xorg.libXrandr # To use the x11 feature
|
||||
libxkbcommon
|
||||
wayland # To use the wayland feature
|
||||
|
||||
# rust toolchain
|
||||
rust-analyzer
|
||||
];
|
||||
LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs;
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user