Skip to content

feat(ci): add OpenHarmony CI and add it to tier2 - #2599

Merged
SteveLauC merged 3 commits into
nix-rust:masterfrom
richerfu:master
Feb 6, 2025
Merged

SteveLauC merged 3 commits into
nix-rust:masterfrom
richerfu:master

Conversation

@richerfu

@richerfu richerfu commented Feb 6, 2025 •

Copy link
Copy Markdown
Contributor

What does this PR do

Add OpenHarmony target into CI and Update documents.

The official support: arm64,arm and x86_64, so i add three targets:

  • aarch64-unknown-linux-ohos
  • armv7-unknown-linux-ohos
  • x86_64-unknown-linux-ohos

Checklist:

  • I have read CONTRIBUTING.md
  • I have written necessary tests and rustdoc comments
  • A change log has been added if this PR modifies nix's API

@SteveLauC

Copy link
Copy Markdown
Member

Any idea what is the minimal Rust version required for these 3 targets?

@richerfu

richerfu commented Feb 6, 2025 •

Copy link
Copy Markdown
Contributor Author

Any idea what is the minimal Rust version required for these 3 targets?

Maybe 1.70.0 and 1.73.0
for arm64 and arm: rust-lang/rust#108792
for x86_64: rust-lang/rust#113061

I want to split it a unique task and use rust with 1.79.0, how about it?

@SteveLauC

Copy link
Copy Markdown
Member

I tend to use the workaround that Loongarch uses:

  1. Specify a separate MSRV for it

    # Rust's Loongarch support merged in 1.71.0
    MSRV_LOONGARCH: 1.71.0

    # Minimal Rust version to support all 3 official OpenHarmony targets
    MSRV_OHOS: 1.79.0 
  2. In the step that sets up Rust toolchain, use that separate MSRV if needed

    - name: setup Rust
    uses: dtolnay/rust-toolchain@master
    with:
    # Use a newer version rustc if the target is Loongarch, remove this workaround after MSRV is newer than 1.71.0
    toolchain: "${{ matrix.target == 'loongarch64-unknown-linux-gnu' && env.MSRV_LOONGARCH || env.MSRV }}"
    components: clippy

     # Use a newer version rustc if it is OpenHarmony, remove this workaround after MSRV is newer than 1.79.0 
     toolchain: "${{ contains(matrix.target, 'ohos')  && env.MSRV_OHOS || env.MSRV }}" 

@SteveLauC

Copy link
Copy Markdown
Member

Maybe 1.70.0 and 1.73.0

Sorry for missing this, if 1.73 will work, we should use it (the minimal one)

@richerfu

richerfu commented Feb 6, 2025 •

Copy link
Copy Markdown
Contributor Author

Maybe 1.70.0 and 1.73.0

Sorry for missing this, if 1.73 will work, we should use it (the minimal one)

1.73 is tier3, if use 1.73, we need to add them into tier3 task. I think using 1.79 be better?

@SteveLauC

Copy link
Copy Markdown
Member

1.73 is tier3, if use 1.73, we need to add them into tier3 task

Thanks for letting me know. Right, we want the Rust tier 2 support.

According to this comment, we should use 1.78 as rust-lang/compiler-team#719 was included in 1.78

@richerfu

richerfu commented Feb 6, 2025 •

Copy link
Copy Markdown
Contributor Author

1.73 is tier3, if use 1.73, we need to add them into tier3 task

Thanks for letting me know. Right, we want the Rust tier 2 support.

According to this comment, we should use 1.78 as rust-lang/compiler-team#719 was included in 1.78

So sorry that i made a mistake in remembering :( and already fixed it.

@SteveLauC

Copy link
Copy Markdown
Member

So sorry that i made a mistake in remembering :( and already fixed it.

No need to be sorry:)

Comment thread README.md Outdated

@SteveLauC SteveLauC left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@SteveLauC
SteveLauC enabled auto-merge February 6, 2025 02:38
@SteveLauC
SteveLauC disabled auto-merge February 6, 2025 04:14
@SteveLauC
SteveLauC merged commit 746cb95 into nix-rust:master Feb 6, 2025
social4hyq pushed a commit to social4hyq/bun-pty that referenced this pull request Jul 12, 2026
The published cloud CI run failed: portable-pty 0.8.1 pulls nix 0.25.1
transitively, which predates OHOS support and misclassifies
target_env="ohos" as glibc-shaped in its cfg_attr repr gating, producing
type mismatches (u32 vs i32/usize) when cross-compiling
aarch64-unknown-linux-ohos from a stock toolchain.

nix 0.30+ added proper *-unknown-linux-ohos handling
(nix-rust/nix#2599/#2587/#2456), but Cargo's [patch.crates-io] can't bump
a transitive dependency to a different same-registry version ("patches
must point to different sources") — so, mirroring the existing fix in the
bun-pty Homebrew formula (Formula/b/bun-pty.rb), vendor a copy of
portable-pty 0.9.0 with just its nix requirement bumped from "0.28" to
"0.31", and path-depend on that instead of the crates.io version.

Verified locally (native aarch64-unknown-linux-ohos build): compiles
clean with nix 0.31.3 resolved, and a real dlopen + PTY spawn/kill
round-trip still passes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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