Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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 develop for native work
  • nix develop .#windows for MinGW cross builds
  • nix develop .#macos for osxcross, when a macOS SDK is configured
  • nix develop .#cross for 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.