audioshader/flake.nix

75 lines
2 KiB
Nix
Raw Normal View History

2025-08-30 20:48:38 +00:00
{
description = "Bevy project with Rust and dependencies via nixpkgs and oxalica/rust-overlay";
inputs = {
2025-08-30 21:59:42 +00:00
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
2025-08-30 20:48:38 +00:00
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
rust-overlay,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
2025-08-30 23:53:21 +00:00
stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.clangStdenv;
2025-08-30 21:59:42 +00:00
rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
nativeBuildInputs = with pkgs; [
rustToolchain
mold
pkg-config
2025-08-30 23:53:21 +00:00
clang
2025-08-30 21:59:42 +00:00
];
xorgBuildInputs = with pkgs; [
xorg.libX11
xorg.libXcursor
xorg.libXi
];
waylandBuildInputs = with pkgs; [
libxkbcommon
wayland
];
buildInputs =
with pkgs;
[
alsa-lib
systemd
vulkan-loader
]
++ xorgBuildInputs
++ waylandBuildInputs;
2025-08-30 22:54:31 +00:00
2025-08-30 23:53:21 +00:00
mkShell = pkgs.mkShell.override {
stdenv = stdenv;
};
in
{
packages.default = pkgs.rustPlatform.buildRustPackage {
inherit stdenv buildInputs nativeBuildInputs;
2025-08-30 22:54:31 +00:00
pname = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.name;
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version;
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
};
2025-08-30 22:17:11 +00:00
devShells.default = mkShell {
2025-08-30 21:59:42 +00:00
inherit buildInputs nativeBuildInputs;
2025-08-30 20:48:38 +00:00
RUST_BACKTRACE = 1;
2025-08-30 21:59:42 +00:00
shellHook = ''
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.lib.makeLibraryPath buildInputs}"
'';
2025-08-30 20:48:38 +00:00
};
}
);
}