diff --git a/Cargo.toml b/Cargo.toml index 54ba4ed..52b8818 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,6 +6,7 @@ description = "A W.I.P. bevy-engine game " authors = ["Johannes Hendrik Gerard van der Weide"] version = "0.1.0" edition = "2021" +rust-version = "1.70" license-file = "LICENSE" readme = "README.md" diff --git a/flake.nix b/flake.nix index 5069afd..9f42e91 100644 --- a/flake.nix +++ b/flake.nix @@ -41,5 +41,9 @@ devShells = forAllSystems ({ pkgs }: { default = import ./nix/shell.nix { inherit pkgs; }; }); + # Builder + packages = forAllSystems ({ pkgs }: { + default = import ./nix/default.nix { inherit pkgs; }; + }); }; } diff --git a/nix/default.nix b/nix/default.nix new file mode 100644 index 0000000..d15332d --- /dev/null +++ b/nix/default.nix @@ -0,0 +1,43 @@ +{ pkgs ? import {} }: + +pkgs.rustPlatform.buildRustPackage { + pname = "hertog-game"; + version = "0.1.0"; + + src = ../.; + + cargoLock = { + lockFile = ../Cargo.lock; + }; + + nativeBuildInputs = with pkgs; [ + rust-bin.stable."1.70.0".default + makeWrapper + pkg-config + ] ++ lib.optionals stdenv.isLinux [ + vulkan-loader + ]; + + buildInputs = with pkgs; [ + ] ++ lib.optionals stdenv.isLinux [ + alsa-lib + libxkbcommon + udev + vulkan-loader + wayland + xorg.libX11 + xorg.libXcursor + xorg.libXi + xorg.libXrandr + ] ++ lib.optionals stdenv.isDarwin [ + darwin.apple_sdk_11_0.frameworks.Cocoa + rustPlatform.bindgenHook + ]; + + postInstall = '' + mkdir $out/bin/assets + mkdir $out/bin/data + cp -r assets $out/bin/ + cp -r data $out/bin/ + ''; +} diff --git a/nix/shell.nix b/nix/shell.nix index dec7473..c751efe 100644 --- a/nix/shell.nix +++ b/nix/shell.nix @@ -2,6 +2,7 @@ pkgs.mkShell { # The Nix packages provided in the environment packages = (with pkgs; [ + rust-bin.stable."1.70.0".default # Fluff cargo-mommy onefetch