matrix-image-editor/flake.nix
2024-05-17 21:06:32 +02:00

90 lines
2.1 KiB
Nix

{
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";
wgsl_analyzer = {
url = "github:wgsl-analyzer/wgsl-analyzer";
inputs.nixpkgs.follows = "nixpkgs";
inputs.crane.follows = "crane";
};
};
outputs = {
self,
nixpkgs,
crane,
fenix,
flake-utils,
wgsl_analyzer,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
craneLib = crane.lib.${system};
rs-toolchain = with fenix.packages.${system};
combine [
complete.toolchain
targets.wasm32-unknown-unknown.latest.rust-std
# 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;
};
devShells.default = pkgs.mkShell rec {
buildInputs = with pkgs; [
pkg-config
rs-toolchain
udev
alsa-lib
vulkan-loader
libxkbcommon
wayland
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr # mold-wrapped
gtk3
clang
trunk
binaryen
wgsl_analyzer.outputs.packages."x86_64-linux".default
];
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
};
});
}