rust_vulkan_test/flake.nix

62 lines
1.8 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
};
};
2024-11-06 22:13:46 +01:00
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
flake-utils.lib.eachSystem flake-utils.lib.allSystems (system:
2024-11-06 13:18:17 +01:00
let
2024-11-06 22:13:46 +01:00
overlays = [ (import rust-overlay) ];
2024-11-06 13:18:17 +01:00
pkgs = import nixpkgs {
2024-11-06 22:13:46 +01:00
inherit system overlays;
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 ]
++ 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;
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 ];
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
}