69 lines
2.1 KiB
Nix
69 lines
2.1 KiB
Nix
{
|
|
description = "Rust ASH 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 = {
|
|
url = "github:nix-community/nixGL";
|
|
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;
|
|
});
|
|
|
|
libs = with pkgs; [ vulkan-headers vulkan-loader vulkan-validation-layers ]
|
|
++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isLinux (with pkgs; [ libxkbcommon wayland libGL ])
|
|
++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isDarwin (with pkgs; [ darwin.apple_sdk.frameworks.SystemConfiguration ]);
|
|
in
|
|
{
|
|
devShells = {
|
|
default = pkgs.mkShell {
|
|
nativeBuildInputs = with pkgs; [
|
|
(rust.override { extensions = ["rust-src" "rust-analyzer"]; })
|
|
pkg-config
|
|
];
|
|
|
|
buildInputs = libs ++ [
|
|
pkgs.nixgl.auto.nixVulkanNvidia pkgs.nixgl.nixVulkanIntel
|
|
];
|
|
|
|
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (with pkgs; [ libxkbcommon wayland libGL ]);
|
|
};
|
|
};
|
|
|
|
packages = {
|
|
default = rustPlatform.buildRustPackage {
|
|
pname = "rust_ash_test";
|
|
version = "0.1.0";
|
|
|
|
src = self;
|
|
|
|
nativeBuildInputs = with pkgs; [ pkg-config shaderc ];
|
|
buildInputs = libs;
|
|
|
|
cargoLock = {
|
|
lockFile = ./Cargo.lock;
|
|
};
|
|
};
|
|
};
|
|
});
|
|
}
|