Add Windows build support and release artifacts #80
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Add Windows cross-compilation support using mingw-w64 on NixOS and include Windows binaries in release artifacts.
Requirements
.exein release artifacts alongside Linux.deband musl binaryImplementation Plan
1. Nix Cross-Compilation (
flake.nix)Add
mkWindowsCraneLibandmkStreamdWindowsfunctions following the existing musl cross-compilation pattern:x86_64-pc-windows-gnupkgs.pkgsCross.mingwW64streamd-windowspackage2. Code Compatibility Fixes
src/config.rs:41~/.config/streamd/config.tomlfallbackdirectories::BaseDirsfor cross-platform fallbacksrc/cli/commands/new.rs:27vicfg!(windows)to default tonotepadon Windowssrc/cli/commands/edit.rs:68visrc/cli/commands/todo.rs:93-98vi+ uses+Nline argnotepad, skip line arg for notepad3. Release Workflow (
.forgejo/workflows/release.yml)nix build .#streamd-windowsstepstreamd-VERSION-windows-x86_64.exeto release artifactsVerification
nix build .#streamd-windows- Build Windows binary locallyfile result/bin/streamd.exe- Verify PE executable formatwine result/bin/streamd.exe --version- Optional smoke testcargo test- Ensure code changes don't break LinuxImplementation Plan
1. Nix Cross-Compilation (
flake.nix)Add
mkWindowsCraneLib(aftermkMuslCraneLibaround line 123):Add
mkStreamdWindows(aftermkStreamdMuslaround line 139):Export package (update packages output around line 191):
2. Code Compatibility Fixes
2.1 Config path fallback (
src/config.rs:41)Replace hardcoded Unix path with cross-platform fallback:
2.2 Editor fallback (
src/cli/commands/new.rs:27,edit.rs:68,todo.rs:93)Replace in all three locations:
2.3 Line number argument (
src/cli/commands/todo.rs:94-98)Handle notepad not supporting
+Nsyntax:3. Release Workflow (
.forgejo/workflows/release.yml)Add Windows build step after musl build:
Update artifact preparation step:
Files to Modify
flake.nixmkWindowsCraneLib,mkStreamdWindows, export packagesrc/config.rssrc/cli/commands/new.rssrc/cli/commands/edit.rssrc/cli/commands/todo.rs.forgejo/workflows/release.ymlVerification
nix build .#streamd-windowsfile result/bin/streamd.exewine result/bin/streamd.exe --versioncargo test(code changes use compile-time cfg)Implementation Summary
PR: #83
Duration: ~15 minutes
Tokens used: ~18k input / ~3k output
Findings
pkgsCross.windows.pthreadshad to go inbuildInputs(linked into the target binary) rather thannativeBuildInputs(tools running on the build host). Putting it innativeBuildInputscaused a Nix evaluation error because it's a Windows-platform package.PE32+ x86-64Windows executable.mkStreamdWindowshad to be disabled (doCheck = false) because Nix tries to run the test binary directly, which fails with "Exec format error" when the target is Windows and Wine is not available in the sandbox.nix flake checkpasses cleanly.