Compile, test, and package Windows 7, 10, and 11 software on Linux inside Wine and Proton environments without a virtual machine.
winesmith is a standalone Rust CLI that downloads pinned Wine and Proton runners, builds reproducible Windows prefixes, and installs Windows toolchains declaratively. It also executes hybrid Wine and Linux host tasks from winesmith.toml and integrates with Nushell 0.117+.
The CLI handles runner provisioning, prefix management, SDK installation, task execution, and shell completion:
- Portable Kron4ek Wine 10 WoW64 builds (
10.0-staging-amd64-wow64) download and unpack without host 32-bit multilib packages, alongsidesystemWine, Steamprotondiscovered vialibraryfolders.vdf,ge-proton, or explicit paths (wine:/path,proton:/path). - Shared named or spec-hashed prefixes under
$XDG_DATA_HOME/winesmith/prefixesand isolated per-project prefixes boot headlessly with Mono, Gecko, and crash dialogs disabled. Each prefix enforces advisoryflocklocking,dosdevices/drive mounts,drive_csymlinks, DLL overrides, registry entries, and automatic drift reconciliation. - Built-in toolchain recipes install
.NET SDK, portable Windows Python via NuGet.nupkg, Inno Setup, NSIS, and optionalwinetricksverbs. Generic[toolchains.custom.*]recipes also unpack.zip,.tar.xz,.tar.gz, and.7zarchives or run.msiand.exeinstallers with SHA-256 checks andwin7compatibility warnings. - The task runner sorts
dependsgraphs, mixes Wine and host shell commands with MiniJinja templates, appliesKEY=VALUEoverrides, and checks/procregexforbid_runningguards. It also skips Wine startup on host-only task graphs and executes--all-targetsmatrices. - Generated Nushell completions use
extern --strictsignatures with explicitinput -> outputtypes,@structured [--json] { from json }output decoding,def --wrappedpassthrough forrunandexec, and local__completequeries. - Every Rust subcommand and generated Nushell signature uses long flags (
--target,--locked,--verbose,--quiet,--help) with no single-dash aliases.
Build and install from source with Rust 1.85+:
git clone https://github.com/BeyondMagic/winesmith.git
cd winesmith
cargo install --path .Check the installed binary and inspect your Linux host environment:
winesmith --version
winesmith doctorYou can run single Windows commands immediately or set up a manifest-driven project.
Run Windows executables in an isolated or spec-hashed shared prefix without creating winesmith.toml:
winesmith exec --win win7 -- cmd /c ver
winesmith exec --win win10 --toolchain python@3.12.7 -- python.exe --versionGenerate a starter manifest (minimal, dotnet, python, or packaging), provision the environment, and run declared tasks:
winesmith init --template dotnet
winesmith setup
winesmith run build config=Release
winesmith run test
winesmith shellConfiguration values merge across six layers, from lowest to highest priority:
- Built-in defaults set
win10,win64,display = "none",kron4ek:10.0-staging-amd64-wow64, andprefix.mode = "shared". - User global settings load from
~/.config/winesmith/config.toml, including optionalsteam_root. - Project configuration loads from the nearest
winesmith.toml, searching upward from the working directory. - Machine-local overrides load from
winesmith.local.tomlnext to the manifest. - Environment variables override earlier layers via
WINESMITH_RUNNER,WINESMITH_WIN,WINESMITH_ARCH,WINESMITH_DISPLAY,WINESMITH_PREFIX,WINESMITH_STEAM_ROOT, andWINESMITH_VAR_<NAME>. - Command-line flags (
--target,--runner,--win,--arch,--display,--gui,--var KEY=VALUE, and positionalKEY=VALUEonrun) take final precedence.
This manifest compiles a .NET 8 application, builds an Inno Setup installer with a running-process guard, and supports separate Windows 7 and Windows 11 targets:
[project]
name = "MyWindowsApp"
[windows]
version = "win10"
arch = "win64"
display = "none"
wineserver_persist_secs = 60
[runner]
kind = "kron4ek"
version = "10.0-staging-amd64-wow64"
[prefix]
mode = "shared"
name = "myapp-net8"
[mounts]
w = "."
[vars]
config = "Release"
project = "src/MyApp.csproj"
[toolchains.dotnet]
version = "8.0.415"
shared_nuget_cache = true
tools = ["dotnet-format"]
[toolchains.inno]
version = "6.7.4"
[targets.win7-x86]
windows = { version = "win7", arch = "win32" }
[targets.win11-x64]
windows = { version = "win11", arch = "win64" }
[tasks.build]
description = "Compile Windows application in Wine"
run = "dotnet build {{ winpath(project) }} -c {{ config }}"
[tasks.package]
description = "Build installer and inspect output on Linux host"
depends = ["build"]
forbid_running = ["(?i)MyWindowsApp\\.exe"]
steps = [
{ wine = "ISCC.exe /DConfig={{ config }} {{ winpath('packaging/setup.iss') }}" },
{ host = "ls -lh Output/" }
]
[tasks.clean]
description = "Remove local build directories"
host = "rm -rf src/bin src/obj Output"Each recipe type installs into drive_c and registers its required Windows environment variables and PATH entries:
[toolchains.dotnet]extracts the Microsoft.NET SDK(win-x64orwin-x86) intoC:\dotnet, setsDOTNET_ROOT, maps host~/.nuget/packageswhenshared_nuget_cache = true, installstemplatesand globaltools, and runspost_installhooks.[toolchains.python]extracts portable Windows Python from NuGet (pythonorpythonx86) intoC:\python, runsensurepip, setsPYTHONUTF8=1andPIP_CACHE_DIR, and installs declaredpackages.[toolchains.inno]installs Inno Setup unattended intoC:\tools\innoand exposesISCC.exeonPATH.[toolchains.nsis]unpacks portable NSIS intoC:\tools\nsisand exposesmakensis.exeonPATH.[toolchains.custom.<name>]downloadshttps://,http://, orfile://URLs with optional SHA-256 checks and either unpacks archives toextract_toor runs.msi/.exeinstallers withinstaller_args. It also configurespath,env,dll_overrides,registrykeys, optionalwinetricksverbs, and Wine or hostpost_installhooks.
Install the autoload script to $XDG_CONFIG_HOME/nushell/autoload/winesmith.nu (or pass --path <FILE>):
winesmith completions install nuReload Nushell or run source ~/.config/nushell/autoload/winesmith.nu. Query subcommands decode JSON automatically when piped, while winesmith run and winesmith exec forward arbitrary Windows flags and KEY=VALUE overrides through def --wrapped:
winesmith env list | where windows == "win7"
winesmith tasks | select name description
winesmith doctor | get checks | where status != "ok"
winesmith runner detect | get local_protonsCommit winesmith.lock produced by winesmith setup and enforce checksum pinning in CI:
winesmith setup --all-targets --locked
winesmith run build --all-targets --locked config=Release
winesmith doctor --jsonThe CLI returns distinct exit codes by failure category (propagating child process codes directly on exec and run):
| Code | Meaning |
|---|---|
0 |
Command succeeded or child process exited with 0. |
1 |
Runtime error, failed download or extraction, failed doctor check, or non-zero child exit code. |
2 |
Invalid CLI flag, missing or invalid winesmith.toml, unknown target or task, or dependency cycle. |
3 |
Missing lockfile under --locked, lockfile drift, or SHA-256 mismatch. |
4 |
Blocked by an active process matching forbid_running. |
Run formatting, static analysis, and unit and integration tests locally:
cargo fmt --all -- --check
cargo clippy --all-targets -- -D warnings
cargo test --all-targets
cargo test --test e2e -- --ignored --nocaptureBuild the static documentation site under documentation/site/:
cd documentation
zensical build --cleanwinesmith is licensed under AGPL-3.0-or-later (LICENSE) with a GCC-style Compilation Output Exception under Section 7 (COPYING.EXCEPTION, explained in ADR-002). Compiled binaries, installers, lockfiles, .cmd wrappers, and shell completion scripts generated by running winesmith are excluded from AGPL-3.0 obligations.