first commit
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 26m10s
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 26m10s
This commit is contained in:
commit
c2e35a35ec
18 changed files with 5400 additions and 0 deletions
101
flake.nix
Normal file
101
flake.nix
Normal file
|
@ -0,0 +1,101 @@
|
|||
{
|
||||
description = "Bevy test rust configuration";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
nixgl = {
|
||||
# Revert this to community version when https://github.com/nix-community/nixGL/pull/187 is merged
|
||||
url = "github:phirsch/nixGL/fix-versionMatch";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.flake-utils.follows = "flake-utils";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, rust-overlay, nixgl }:
|
||||
flake-utils.lib.eachSystem flake-utils.lib.allSystems (system:
|
||||
let
|
||||
overlays = [ (import rust-overlay) nixgl.overlay ];
|
||||
pkgs = import nixpkgs {
|
||||
inherit system overlays;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
rust = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||
|
||||
rustPlatform = pkgs.recurseIntoAttrs (pkgs.makeRustPlatform {
|
||||
rustc = rust;
|
||||
cargo = rust;
|
||||
});
|
||||
|
||||
renderdoc = pkgs.renderdoc.overrideAttrs (oldAttrs: {
|
||||
cmakeFlags = oldAttrs.cmakeFlags ++ [
|
||||
(pkgs.lib.cmakeBool "ENABLE_UNSUPPORTED_EXPERIMENTAL_POSSIBLY_BROKEN_WAYLAND" true)
|
||||
];
|
||||
});
|
||||
|
||||
buildInputs = with pkgs; [ vulkan-headers vulkan-loader vulkan-validation-layers renderdoc ]
|
||||
++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isLinux (with pkgs; [
|
||||
stdenv.cc.cc.lib
|
||||
|
||||
# Wayland
|
||||
libxkbcommon
|
||||
wayland
|
||||
libGL
|
||||
# Xorg
|
||||
xorg.libX11
|
||||
xorg.libXcursor
|
||||
xorg.libXi
|
||||
xorg.libxcb
|
||||
xorg.libxshmfence
|
||||
|
||||
alsa-lib
|
||||
systemd # libudev-sys dependencies
|
||||
])
|
||||
++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isDarwin (with pkgs; [ darwin.apple_sdk.frameworks.SystemConfiguration ]);
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
pkg-config
|
||||
cmake
|
||||
python312
|
||||
];
|
||||
|
||||
mkCustomShell = { packages ? [ ] }: pkgs.mkShell {
|
||||
nativeBuildInputs = [
|
||||
renderdoc
|
||||
(rust.override { extensions = [ "rust-src" "rust-analyzer" ]; })
|
||||
] ++ nativeBuildInputs;
|
||||
|
||||
buildInputs = buildInputs
|
||||
++ packages;
|
||||
|
||||
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
|
||||
VK_LAYER_PATH = "${pkgs.vulkan-validation-layers}/share/vulkan/explicit_layer.d:${renderdoc}/share/vulkan/implicit_layer.d";
|
||||
RUST_LOG = "info,rust_vulkan_test=trace";
|
||||
};
|
||||
in
|
||||
{
|
||||
devShells = {
|
||||
default = mkCustomShell { packages = [ pkgs.nixgl.auto.nixVulkanNvidia pkgs.nixgl.nixVulkanMesa ]; };
|
||||
nixos = mkCustomShell { };
|
||||
};
|
||||
|
||||
packages = {
|
||||
default = rustPlatform.buildRustPackage {
|
||||
pname = "rust_ash_test";
|
||||
version = "0.1.0";
|
||||
|
||||
src = self;
|
||||
|
||||
inherit nativeBuildInputs buildInputs;
|
||||
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue