Skip to content
This repository was archived by the owner on Oct 2, 2026. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ rix-eval = { path = "rix-eval" }
usage = { package = "usage-rs", version = "6.9.1" }
thiserror = "2.0.20"
rootcause = "0.13.0"
annotate-snippets = "0.12.16"
rowan = "0.17.0"
serde = { version = "1.0.229", features = ["derive"] }
serde_json = "1.0.151"
Expand All @@ -35,6 +36,7 @@ reqwest = { version = "0.13", default-features = false, features = ["blocking",
flate2 = { version = "1.1.10", features = ["zlib-rs"], default-features = false }
tar = "0.4"
colored = "2.2"
parking_lot = "0.12"

[profile.dev.package."*"]
opt-level = 3
Expand Down
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,46 @@ This project is based on:

- [Tom's nix-eval crate](https://github.com/Industrial/nixos-dotfiles/tree/main/rust/tools/nix-eval)
- [rnix parser](https://github.com/nix-community/rnix-parser)

## Cross compilation (work in progress)

Rix tracks two platform triples (a `cpu-os` pair such as `x86_64-linux` or
`x86_64-darwin`) while building:

- the *build* platform performs the build (the machine running `rix`), and
- the *host* platform runs the produced package.

They are configured with global flags:

```console
$ rix build -A xnu --system x86_64-linux --cross-system x86_64-darwin
```

- `--system` sets the build platform and what `builtins.currentSystem`
reports. It defaults to the running machine.
- `--cross-system` sets the host platform. When it differs from the build
platform the build is a cross build.
- `--runner` gives the command used to execute host-platform binaries during
the build (for example `--runner darling` for Darwin binaries on Linux, or
`--runner wine` for Windows).

The platforms are exposed to build scripts as `$buildPlatform`,
`$hostPlatform` and `$system` (the host platform), and to Nix expressions as

- `builtins.currentSystem` / `builtins.currentBuildPlatform`,
- `builtins.currentHostPlatform`, and
- `builtins.isCrossCompiling`.

When a runner is configured, Rix installs a `rix-run-host` helper on `PATH`
(its path is also exported as `$RIX_TARGET_RUNNER`) that executes a
host-platform binary through the runner:

```sh
rix-run-host ./target-binary --some-flag
```

Without an explicit runner, same-OS foreign-CPU builds (for example
`x86_64-linux` -> `aarch64-linux`) fall back to a `qemu-<arch>-static` style
emulator, and other combinations only warn that host binaries cannot run.
Rix deliberately does not guess a runner from `PATH` so that a misconfigured
cross build fails loudly rather than silently doing the wrong thing.
1 change: 1 addition & 0 deletions rix-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ rix-eval.workspace = true
serde_json.workspace = true
colored.workspace = true
rootcause.workspace = true
annotate-snippets.workspace = true
Loading