106 lines
2.4 KiB
Nix
106 lines
2.4 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, rust-overlay, flake-utils }:
|
|
flake-utils.lib.eachDefaultSystem (
|
|
system:
|
|
let
|
|
overlays = [
|
|
(import rust-overlay)
|
|
];
|
|
pkgs = import nixpkgs {
|
|
inherit system overlays;
|
|
};
|
|
|
|
app = "bevy_test";
|
|
|
|
rust = pkgs.rust-bin.stable.latest.default.override { extensions = [ "rust-src" ]; };
|
|
rustPlatform = pkgs.makeRustPlatform {
|
|
cargo = rust;
|
|
rustc = rust;
|
|
};
|
|
|
|
shellInputs = [
|
|
rust
|
|
pkgs.clang
|
|
];
|
|
appNativeBuildInputs = with pkgs; [
|
|
pkg-config
|
|
];
|
|
appBuildInputs = appRuntimeInputs ++ (with pkgs; [
|
|
udev
|
|
alsaLib
|
|
wayland
|
|
vulkan-tools
|
|
vulkan-headers
|
|
vulkan-validation-layers
|
|
]);
|
|
appRuntimeInputs = with pkgs; [
|
|
vulkan-loader
|
|
libxkbcommon
|
|
];
|
|
in
|
|
{
|
|
devShells =
|
|
let
|
|
game = pkgs.mkShell {
|
|
nativeBuildInputs = appNativeBuildInputs;
|
|
buildInputs = shellInputs ++ appBuildInputs;
|
|
|
|
shellHook = ''
|
|
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.lib.makeLibraryPath appRuntimeInputs}"
|
|
'';
|
|
};
|
|
in
|
|
rec {
|
|
${app} = game;
|
|
default = game;
|
|
};
|
|
|
|
packages =
|
|
let
|
|
game = rustPlatform.buildRustPackage {
|
|
pname = app;
|
|
version = "0.1.0";
|
|
|
|
src = ./.;
|
|
|
|
cargoLock = {
|
|
lockFile = ./Cargo.lock;
|
|
};
|
|
|
|
nativeBuildInputs = appNativeBuildInputs;
|
|
buildInputs = appBuildInputs;
|
|
|
|
postInstall = ''
|
|
cp -r assets $out/bin/
|
|
'';
|
|
};
|
|
in
|
|
rec {
|
|
${app} = game;
|
|
default = game;
|
|
};
|
|
|
|
apps =
|
|
let
|
|
game = {
|
|
type = "app";
|
|
program = "${self.packages.${app}}/bin/${app}";
|
|
};
|
|
in
|
|
rec {
|
|
${app} = game;
|
|
default = game;
|
|
};
|
|
|
|
checks.build = self.packages.${system}.${app};
|
|
}
|
|
);
|
|
}
|
|
|