Skip to content

feat(quickemu): derive SHARE_PATH from QEMU binary#1819

Merged
flexiondotorg merged 2 commits intomasterfrom
share-path
Jan 24, 2026
Merged

feat(quickemu): derive SHARE_PATH from QEMU binary#1819
flexiondotorg merged 2 commits intomasterfrom
share-path

Conversation

@flexiondotorg
Copy link
Member

Summary

Derive SHARE_PATH from the actual QEMU binary location instead of using package-manager-specific detection (Homebrew). Adds a robust helper to resolve the share path used for firmware and data, and simplifies devshell.nix by removing now-unnecessary Darwin/Homebrew sed patches.

Changes

  • Add get_qemu_share_path() in quickemu:
    • Resolve symlinks using realpath with macOS fallback when GNU coreutils are not available.
    • Derive share path from the QEMU binary path (e.g. /.../bin/qemu-system-*/.../share).
    • Validate the path contains a qemu firmware directory and fall back to /usr/share for system installs.
  • Replace the previous hardcoded Darwin/Homebrew detection in configure_bios() with a call to get_qemu_share_path.
  • Remove the Darwin/Homebrew SHARE_PATH sed patches from devshell.nix; keep OVMF firmware path patches.

Benefits

  • Works with any QEMU installation (Nix, Homebrew, MacPorts, system packages, custom builds).
  • Self-documenting: the share path is derived from the binary that will be executed.
  • Eliminates package-manager-specific heuristics and simplifies devshell.nix.

Testing

  • Manual testing with multiple QEMU installs (system, Homebrew, Nix) to verify correct share path resolution.
  • Existing quickemu tests and shellcheck linting unchanged; devshell.nix simplified without affecting OVMF patches.

Related

Implements "SHARE_PATH from QEMU binary" from TODO.md Phase 2.

- Add get_qemu_share_path() to resolve the QEMU binary realpath and
derive
  a matching share directory (handles symlinks, Nix store paths,
Homebrew,
  MacPorts and custom builds)
- Replace ad-hoc brew/system logic in configure_bios with resolved share
path
- Fallback to /usr/share when no qemu firmware directory is found
Improve firmware/OVMF lookup reliability for non-system QEMU
installations.

Signed-off-by: Martin Wimpress <martin@wimpress.org>
- Remove sed expressions that replaced local SHARE_PATH and removed
Homebrew check
- Rely on existing darwin-specific substitutions and Nix-provided qemu
paths
- Simplify shellHook and avoid accidental replacements on non-Darwin
systems

Signed-off-by: Martin Wimpress <martin@wimpress.org>
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@flexiondotorg flexiondotorg merged commit ea1fbf6 into master Jan 24, 2026
3 of 5 checks passed
@flexiondotorg flexiondotorg deleted the share-path branch January 24, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant