bin-projekt/flake.nix

80 lines
1.8 KiB
Nix
Raw Normal View History

2024-04-26 06:32:03 +00:00
{
description = "Build a cargo project without extra checks";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
nixpkgs,
crane,
fenix,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
craneLib = crane.lib.${system};
rs-toolchain = with fenix.packages.${system};
combine [
default.toolchain
rust-analyzer
];
my-crate = craneLib.buildPackage {
src = craneLib.cleanCargoSource (craneLib.path ./.);
strictDeps = true;
buildInputs =
[
# Add additional build inputs here
]
++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
# Additional darwin specific inputs can be set here
pkgs.libiconv
];
# Additional environment variables can be set directly
# MY_CUSTOM_VAR = "some value";
};
in {
packages.default = my-crate;
apps.default = flake-utils.lib.mkApp {
drv = my-crate;
};
2024-04-26 18:27:27 +00:00
devShells.default = pkgs.mkShell rec {
2024-04-26 06:32:03 +00:00
buildInputs = with pkgs; [
pkg-config
rs-toolchain
udev
alsa-lib
vulkan-loader
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr # To use the x11 feature
libxkbcommon
2024-04-26 18:27:27 +00:00
wayland
2024-04-26 06:32:03 +00:00
mold-wrapped
2024-04-26 18:27:27 +00:00
clang
2024-04-26 06:32:03 +00:00
];
2024-04-26 18:27:27 +00:00
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
2024-04-26 06:32:03 +00:00
};
});
}