81 lines
2.1 KiB
Nix
81 lines
2.1 KiB
Nix
{
|
|
description = "A devShell example";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs =
|
|
{
|
|
nixpkgs,
|
|
rust-overlay,
|
|
flake-utils,
|
|
...
|
|
}:
|
|
flake-utils.lib.eachDefaultSystem (
|
|
system:
|
|
let
|
|
overlays = [ (import rust-overlay) ];
|
|
pkgs = import nixpkgs {
|
|
inherit system overlays;
|
|
crossSystem = {
|
|
config = "x86_64-w64-mingw32";
|
|
};
|
|
config.microsoftVisualStudioLicenseAccepted = true;
|
|
};
|
|
# I don't understand why we need this instead of just using pkgs.pkgsBuildHost,
|
|
# but the wine64 from here works and the wine64 from pkgs.pkgsBuildHost doesn't.
|
|
pkgsLocal = import nixpkgs {
|
|
inherit system;
|
|
};
|
|
rust-toolchain = pkgs.pkgsBuildHost.rust-bin.stable.latest.default.override {
|
|
extensions = [
|
|
"rust-src"
|
|
"rust-analyzer"
|
|
];
|
|
targets = [
|
|
"wasm32-unknown-unknown"
|
|
"x86_64-pc-windows-gnu"
|
|
];
|
|
};
|
|
in
|
|
with pkgs;
|
|
{
|
|
devShells.default = mkShell rec {
|
|
nativeBuildInputs = [
|
|
rust-toolchain
|
|
pkgsLocal.llvmPackages.bintools # To use lld linker
|
|
pkgsLocal.openssl
|
|
pkgsLocal.eza
|
|
pkgsLocal.fd
|
|
pkgsLocal.udev
|
|
pkgsLocal.alsa-lib-with-plugins
|
|
pkgsLocal.vulkan-loader
|
|
pkgsLocal.xorg.libX11
|
|
pkgsLocal.xorg.libXcursor
|
|
pkgsLocal.xorg.libXi
|
|
pkgsLocal.xorg.libXrandr # To use the x11 feature
|
|
pkgsLocal.libxkbcommon
|
|
pkgsLocal.wayland # To use the wayland feature
|
|
pkgsLocal.clang
|
|
pkgsLocal.nil
|
|
pkgsLocal.nixfmt
|
|
];
|
|
|
|
buildInputs = [
|
|
pkgs.windows.pthreads
|
|
];
|
|
|
|
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath nativeBuildInputs;
|
|
|
|
shellHook = ''
|
|
alias ls=exa
|
|
alias find=fd
|
|
'';
|
|
};
|
|
}
|
|
);
|
|
}
|