khors/flake.nix

74 lines
1.9 KiB
Nix
Raw Normal View History

2024-03-26 22:44:34 -06:00
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs = { self, flake-utils, naersk, nixpkgs }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = (import nixpkgs) { inherit system; };
naersk' = pkgs.callPackage naersk { };
libPath = with pkgs;
lib.makeLibraryPath [
libGL
libxkbcommon
wayland
glibc
vulkan-loader
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
alsa-lib
vulkan-tools
];
in rec {
# For `nix build` & `nix run`:
packages.default = naersk'.buildPackage {
src = ./.;
pname = "khors";
nativeBuildInputs = with pkgs; [
makeWrapper
pkg-config
openssl
xorg.libxcb
];
GIT_HASH = "000000000000000000000000000000";
postInstall = ''
wrapProgram "$out/bin/${packages.default.pname}" --prefix LD_LIBRARY_PATH : "${libPath}"
'';
};
# For `nix develop`:
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
rustc
cargo
cargo-watch
clippy
rustfmt
rust-analyzer
cmake
vulkan-tools
python3
vulkan-tools-lunarg
pkg-config
openssl
xorg.libxcb
alsa-lib
];
LD_LIBRARY_PATH = libPath;
env = {
VK_LAYER_PATH = "${pkgs.vulkan-validation-layers}/share/vulkan/explicit_layer.d";
RUST_BACKTRACE = 1;
RUST_LOG = "debug";
};
};
});
}