ambition/flake.nix
Muhammad Nauman Raza bf2ed5e610
hotfix: LD_LIBRARY_PATH missing some packages
Former-commit-id: 46f6d5934d2bb304b37e44bf89b72d85ec2eb232
2023-11-27 21:44:35 +00:00

79 lines
2.3 KiB
Nix

{
description = "Rust development environment for Aspiration using fenix";
inputs = {
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
utils.url = "github:numtide/flake-utils";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
nixgl.url = "github:guibou/nixGL";
};
outputs = {
self,
nixpkgs-unstable,
utils,
fenix,
nixgl,
...
}:
utils.lib.eachDefaultSystem
(
system: let
pkgs = import nixpkgs-unstable {
inherit system;
overlays = [fenix.overlays.default nixgl.overlay];
};
toolchain = pkgs.fenix.complete;
in rec
{
# Executed by `nix build`
packages.default =
(pkgs.makeRustPlatform {
# Use nightly rustc and cargo provided by fenix for building
inherit (toolchain) cargo rustc;
})
.buildRustPackage {
pname = "aspiration";
version = "0.1.0";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
# For other makeRustPlatform features see:
# https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/rust.section.md#cargo-features-cargo-features
};
# Executed by `nix run`
apps.default = utils.lib.mkApp {drv = packages.default;};
# Used by `nix develop`
devShells.default = pkgs.mkShell rec {
shellHook = ''export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.lib.makeLibraryPath [
pkgs.vulkan-loader
pkgs.udev
pkgs.alsa-lib
]}"'';
# Use nightly cargo & rustc provided by fenix. Add for packages for the dev shell here
buildInputs = with pkgs; [
(with toolchain; [
cargo rustc rust-src clippy rustfmt # rust components
])
xorg.libX11 xorg.libXcursor xorg.libXi xorg.libXrandr # To use the x11 feature
libxkbcommon wayland # To use the wayland feature
udev alsa-lib vulkan-loader
pkgs.nixgl.nixVulkanIntel
mold
clang
pkg-config
];
# Specify the rust-src path (many editors rely on this)
RUST_SRC_PATH = "${toolchain.rust-src}/lib/rustlib/src/rust/library";
};
}
);
}