rust_vulkan_test/flake.nix

70 lines
2.1 KiB
Nix
Raw Normal View History

2024-11-06 13:18:17 +01:00
{
2024-11-06 22:13:46 +01:00
description = "Rust ASH test rust configuration";
2024-11-06 13:18:17 +01:00
2024-11-06 22:13:46 +01:00
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";
2024-11-06 13:18:17 +01:00
};
nixgl = {
url = "github:nix-community/nixGL";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
2024-11-06 13:18:17 +01:00
};
outputs = { self, nixpkgs, flake-utils, rust-overlay, nixgl }:
2024-11-06 22:13:46 +01:00
flake-utils.lib.eachSystem flake-utils.lib.allSystems (system:
2024-11-06 13:18:17 +01:00
let
overlays = [ (import rust-overlay) nixgl.overlay ];
2024-11-06 13:18:17 +01:00
pkgs = import nixpkgs {
2024-11-06 22:13:46 +01:00
inherit system overlays;
config.allowUnfree = true;
2024-11-06 13:18:17 +01:00
};
2024-11-06 22:13:46 +01:00
rust = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
2024-11-06 13:18:17 +01:00
2024-11-06 22:13:46 +01:00
rustPlatform = pkgs.recurseIntoAttrs (pkgs.makeRustPlatform {
rustc = rust;
cargo = rust;
});
libs = with pkgs; [ vulkan-headers vulkan-loader vulkan-validation-layers ]
2024-11-06 22:13:46 +01:00
++ 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 ]);
2024-11-06 13:18:17 +01:00
in
{
2024-11-06 22:13:46 +01:00
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
];
2024-11-06 22:13:46 +01:00
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;
2024-11-27 22:44:47 +01:00
nativeBuildInputs = with pkgs; [ pkg-config shaderc ];
2024-11-06 22:13:46 +01:00
buildInputs = libs;
2024-11-06 13:18:17 +01:00
2024-11-06 22:13:46 +01:00
cargoLock = {
lockFile = ./Cargo.lock;
};
};
2024-11-06 13:18:17 +01:00
};
2024-11-06 22:13:46 +01:00
});
2024-11-06 13:18:17 +01:00
}