Files
solidcraft-upstream/docs/nix.md
T
Levon Kirakosyan c308a1ba7a build: macOS support for the Nix flake
Add aarch64-darwin to the flake systems so packages, apps and both
devShells are exposed on Apple Silicon Macs. The Wayland/X11/EGL
runtime libraries, the /run/opengl-driver search paths, the freedesktop
packaging and the wrapProgram post-fixup are Linux-only and stay that
way: on macOS winit talks to AppKit, wgpu renders through Metal, and
the GPU drivers ship with the OS, so the darwin package needs no
wrapper. x86_64-darwin is deliberately not added: current nixpkgs
unstable no longer evaluates rustc for that platform (26.11
deprecation), so the package would fail on toolchain evaluation.

docs/nix.md: platform list updated, macOS paragraph in the graphics
section, desktop-entry paragraph qualified as Linux-only.
2026-10-12 10:06:03 -04:00

4.1 KiB

SolidCraft with Nix

The flake supports x86_64-linux, aarch64-linux and aarch64-darwin. Enable Nix's nix-command and flakes experimental features. The committed flake.lock pins nixpkgs and its Rust toolchain; package evaluation checks that compiler against the Rust floor in Cargo.toml.

Run, build or install

Run the current app without installing it:

nix run github:bherbruck/solidcraft#solidcraft -- --sample

Inside a checkout, nix run . and nix run .#solidcraft launch the desktop app. nix run .#cli -- --version launches the CLI. The legacy .#solvecraft app name also works. These commands use the flake's exact wrapped binary, rather than an older executable already on your shell's PATH.

Build without installing:

nix build github:bherbruck/solidcraft#solidcraft
./result/bin/solidcraft --version
./result/bin/solidcraft --sample

The result contains solidcraft, the compatible solvecraft binary name, and solvecraft-cli. Building does not install a desktop-menu entry. For a user profile installation, run:

nix profile install github:bherbruck/solidcraft#solidcraft
solidcraft --sample

On Linux, this installs the SolidCraft desktop entry, MIME definition and generated icon sizes alongside the commands. On macOS the package contains the binaries only; for a bundled SolveCraft.app, use the release .dmg. NixOS/Home Manager can instead put the flake's packages.${system}.solidcraft in environment.systemPackages/home.packages. If a non-NixOS desktop does not discover profile-installed launchers, ensure that its session includes ~/.nix-profile/share in XDG_DATA_DIRS, then log out and back in. The existing ai.storyteller.solvecraft desktop/application ID and .solvecraft design files remain compatible.

Check which executable a plain terminal command would run:

type -a solidcraft solvecraft
readlink -f "$(command -v solidcraft)"
solidcraft --version
nix run github:bherbruck/solidcraft#solidcraft -- --version

An unrelated old solvecraft executable on PATH is not updated by nix build. Use the flake app or ./result/bin/solidcraft to verify the package you just built.

Graphics and file dialogs

The app wrapper includes Wayland, X11, xkbcommon, EGL, Vulkan-loader and D-Bus libraries. It exposes /run/opengl-driver/lib and /run/opengl-driver/share so NixOS's graphics drivers and Vulkan manifests are discoverable. Enable hardware.graphics.enable = true on NixOS and keep the system's driver stack consistent with the compositor. File pickers also need a working session D-Bus and the desktop's xdg-desktop-portal service.

On macOS (aarch64-darwin), none of this applies: winit talks to AppKit, wgpu renders through Metal, and the GPU drivers ship with the operating system, so the darwin package carries no library wrapper and no extra search paths.

On another distribution, graphics drivers outside the Nix store may need a matching nixGL wrapper. Follow its GPU-specific instructions; a wrapper for a different driver is not a substitute. For Intel/Mesa, after building:

nix run github:nix-community/nixGL#nixGLIntel -- ./result/bin/solidcraft --sample

If a window is black, first verify that you launched the newly wrapped package and that your system exposes a functioning GPU driver. WGPU_BACKEND=vulkan selects Vulkan for diagnosis; a loader without a usable driver still cannot render. OpenGL rendering uses 1x anti-aliasing to avoid the multisampled black-frame failure. Vulkan and other backends keep the requested sample count; saved preferences are preserved. For older builds, including 0.3.0, set Anti-aliasing to 1x and restart when using OpenGL. If that window cannot show the settings dialog, edit only the msaa field to 1 in ~/.local/share/solvecraft/graphics.json; preserve any other settings.

Development shells

nix develop supplies runtime libraries and uses the Rust/C toolchain already on your PATH. nix develop .#rust supplies the pinned toolchain, C linker and target/nix build directory. Both retain the GUI and CLI's existing Cargo package names (solvecraft, solvecraft-cli).