Skip to content

fix: make qemu script runnable - #1098

Merged
ipetkov merged 1 commit into
ipetkov:masterfrom
danielrainer10:cross-compilation-example-app-fix
Nov 3, 2026
Merged

ipetkov merged 1 commit into
ipetkov:masterfrom
danielrainer10:cross-compilation-example-app-fix

Conversation

@danielrainer10

Copy link
Copy Markdown
Contributor

In the cross-compilation example flake, pkgs has crossSystem set up for cross-compilation. This results in plain pkgs.writeScriptBin writing a binary for the host system. Since the point of the default app in this example is to run the cross-compiled binary using qemu, this should run on the build system, which is achieved by using pkgs.pkgsBuildBuild. Additionally, writeScriptBin does not add a shebang line. Using writeShellScriptBin instead fixes this problem and results in a runnable script that executes the binary using qemu on the build system.

Checklist

  • added tests to verify new behavior
  • added an example template or updated an existing one
  • updated docs/API.md (or general documentation) with changes
  • updated CHANGELOG.md

In the cross-compilation example flake, `pkgs` has `crossSystem` set up
for cross-compilation. This results in plain `pkgs.writeScriptBin`
writing a binary for the host system. Since the point of the default app
in this example is to run the cross-compiled binary using qemu, this
should run on the build system, which is achieved by using
`pkgs.pkgsBuildBuild`. Additionally, `writeScriptBin` does not add a
shebang line. Using `writeShellScriptBin` instead fixes this problem and
results in a runnable script that executes the binary using qemu on the
build system.
@ipetkov

ipetkov commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Thanks for the fix!

@ipetkov
ipetkov enabled auto-merge (squash) November 3, 2026 01:32
@ipetkov
ipetkov merged commit 788369e into ipetkov:master Nov 3, 2026
20 checks passed

This branch was previously deployed

1 inactive deployment
cachix — 9a2961a4 Deployed Nov 3, 2026 by danielrainer10 via build examples (alt-registry) #1838
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.

2 participants