Quick Start
The fastest path is to create a toolchain, generate cross helpers, then feed both into mkDevShells.
{
outputs = { self, nixpkgs, harbor-rs, flake-utils, rust-overlay, ... }:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [(import rust-overlay)];
};
toolchain = harbor-rs.lib.mkToolchain { inherit pkgs; };
cross = harbor-rs.lib.mkCross { inherit pkgs system; };
in {
devShells = harbor-rs.lib.mkDevShells {
inherit pkgs cross;
inherit (toolchain) craneLib;
};
});
}
This produces four shells:
nix developfor native worknix develop .#windowsfor MinGW cross buildsnix develop .#macosfor osxcross, when a macOS SDK is configurednix develop .#crossfor both Windows and macOS helpers together
If you need more control over the generated shell environment, read mkDevShell and mkDevShells. If you need macOS SDK setup, read macOS SDK Initialization.