This commit is contained in:
Leon Liu 2025-08-18 03:12:11 +00:00
parent d3b23639cd
commit fcbb5f87ba
4 changed files with 55 additions and 26 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
/target/ /target/
/.claude/ /.claude/
/.direnv/ /.direnv/
/*.exe

View File

@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2024" edition = "2024"
[dependencies] [dependencies]
bevy = "0.16" bevy = { version = "0.16", features = ["wayland"] }
bevy-inspector-egui = "0.33.1" bevy-inspector-egui = "0.33.1"
bevy_panorbit_camera = "0.28" bevy_panorbit_camera = "0.28"
big_space = { version = "0.10.0", features = ["camera"] } big_space = { version = "0.10.0", features = ["camera"] }
@ -30,4 +30,4 @@ opt-level = 1
opt-level = 3 opt-level = 3
[features] [features]
default = ["bevy/bevy_dev_tools", "bevy/dynamic_linking"] dev = ["bevy/bevy_dev_tools", "bevy/dynamic_linking"]

View File

@ -7,44 +7,68 @@
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = { nixpkgs, rust-overlay, flake-utils, ... }: outputs =
flake-utils.lib.eachDefaultSystem (system: {
nixpkgs,
rust-overlay,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let let
overlays = [ (import rust-overlay) ]; overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system overlays; inherit system overlays;
crossSystem = {
config = "x86_64-w64-mingw32";
};
config.microsoftVisualStudioLicenseAccepted = true;
};
# I don't understand why we need this instead of just using pkgs.pkgsBuildHost,
# but the wine64 from here works and the wine64 from pkgs.pkgsBuildHost doesn't.
pkgsLocal = import nixpkgs {
inherit system;
};
rust-toolchain = pkgs.pkgsBuildHost.rust-bin.stable.latest.default.override {
extensions = [
"rust-src"
"rust-analyzer"
];
targets = [
"wasm32-unknown-unknown"
"x86_64-pc-windows-gnu"
];
}; };
in in
with pkgs; with pkgs;
{ {
devShells.default = mkShell rec { devShells.default = mkShell rec {
nativeBuildInputs = [ nativeBuildInputs = [
pkg-config rust-toolchain
llvmPackages.bintools # To use lld linker pkgsLocal.llvmPackages.bintools # To use lld linker
pkgsLocal.openssl
pkgsLocal.eza
pkgsLocal.fd
pkgsLocal.udev
pkgsLocal.alsa-lib-with-plugins
pkgsLocal.vulkan-loader
pkgsLocal.xorg.libX11
pkgsLocal.xorg.libXcursor
pkgsLocal.xorg.libXi
pkgsLocal.xorg.libXrandr # To use the x11 feature
pkgsLocal.libxkbcommon
pkgsLocal.wayland # To use the wayland feature
pkgsLocal.clang
pkgsLocal.nil
pkgsLocal.nixfmt
]; ];
buildInputs = [ buildInputs = [
openssl pkgs.windows.pthreads
pkg-config
eza
fd
(rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override {
extensions = [ "rust-src" "rust-analyzer" ];
targets = [ "wasm32-unknown-unknown" ];
}))
udev
alsa-lib-with-plugins
vulkan-loader
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr # To use the x11 feature
libxkbcommon
wayland # To use the wayland feature
clang
]; ];
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs; LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath nativeBuildInputs;
shellHook = '' shellHook = ''
alias ls=exa alias ls=exa

4
win Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
cargo build --target x86_64-pc-windows-gnu &&
cp target/x86_64-pc-windows-gnu/debug/solar-sim.exe . &&
exec ./solar-sim.exe "$@"