Skip to content

systems: rename extant wasi targets to wasip1 - #537429

Merged
philiptaron merged 3 commits into
NixOS:masterfrom
sepointon:2026-07-wasip1-rename
Jul 28, 2026
Merged

philiptaron merged 3 commits into
NixOS:masterfrom
sepointon:2026-07-wasip1-rename

Conversation

@sepointon

Copy link
Copy Markdown
Contributor

Wasi P2 is different enough to Wasi P1 to warrant being treated entirely separately, rather than as two minor variants of the same thing. P3 will likewise want to be a different target.

I've left aliases in place; maybe eventually, those can be deprecated and removed. I've tested this, but it's possible there might be breakage somewhere (e.g., the canonical doubles for P1 have changed, though I can't imagine why anyone would rely on that).

Fixes #435954

Things done

@nixpkgs-ci
nixpkgs-ci Bot requested review from a team, alyssais and llakala July 1, 2026 13:41
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 6.topic: lib The Nixpkgs function library labels Jul 1, 2026
@sepointon sepointon mentioned this pull request Jul 1, 2026
2 of 13 tasks
@sepointon

Copy link
Copy Markdown
Contributor Author

Also: this is definitely worth a release note because there's a bit of a chance of breakage.

Comment thread lib/systems/default.nix
freebsd = "FreeBSD";
openbsd = "OpenBSD";
wasi = "Wasi";
wasip1 = "WasiP1";

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.

Is there any actual uname -s that supports WASI and will output this? It seems like the null default may be more honest.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I had the same thought, but this is actually critical to set: via CMake, determines the output path of libclang_rt s.t. clang can find it.

Comment thread lib/systems/examples.nix Outdated
Comment on lines 452 to 456
# For historical reasons, Nixpkgs's wasi32 (i.e., without a revision number) corresponds to WASI p1.
wasi32 = {
config = "wasm32-unknown-wasi";
config = "wasm32-unknown-wasip1";
useLLVM = true;
};

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.

Perhaps we should rename this to wasm32-wasip1 and alias wasi32 to it. Later we could potentially add a warning.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, does make sense to hit this at the same time as everything else.

Comment thread lib/systems/inspect.nix
Comment on lines +396 to 398
isWasiP1 = {
kernel = kernels.wasip1;
};

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.

It’s probably not going to be common to condition on this specifically? Maybe a case of YAGNI, since you can always just write out the pattern explicitly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Have a look at the wasip2 PR, where it makes a lot more sense for parallelism purposes, maybe? It does have two in-tree uses and I expect that to grow as things need to distinguish p1 from p2.

Comment thread lib/systems/parse.nix
Comment on lines +604 to 607
wasip1 = {
execFormat = wasm;
families = { };
};

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.

Perhaps we ought to have a family for WASI, as with BSD and Darwin. Then lib.systems.inspect.isWasi can use that, and will work with newer WASI versions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What're the criteria for considering something a 'family'? I would actually be quite suspicious of non-trivial things claiming to not care about p1 vs p2; they really are very different. (p2 and p3 have a lot of commonality, but that's looking further ahead than this PR.)

Comment thread lib/systems/parse.nix Outdated
Comment on lines +948 to +950
else if args.kernel == "wasi" then
# For historical reasons, bare 'wasi' (i.e., without a revision number) corresponds to wasip1.
kernels.wasip1

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.

getKernel will already handle this, since you added an alias for wasi there. (I don’t know whether it makes sense to express the WASIp1 vs. WASIp2 difference as an “ABI” suffix – probably not?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nifty, thanks! Less conditionals is more happy.

Comment on lines -98 to 105
wasm32-wasi = {
wasm32-wasip1 = {
magicOrExtension = ''\x00asm'';
mask = ''\xff\xff\xff\xff'';
};
wasm64-wasi = {
wasm64-wasip1 = {
magicOrExtension = ''\x00asm'';
mask = ''\xff\xff\xff\xff'';
};

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.

I guess we could add aliases for these too, although it might not be important enough to.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I basically just hit these because they turned up while grepping. It's awkward because wasip2 will also match these magic numbers. I'm somewhat reluctant to think too hard about this because it's unlikely anything too critical is relying on it and it can be fixed up later if it does turn out to matter.

@sepointon
sepointon force-pushed the 2026-07-wasip1-rename branch from 716e88e to 3b6552f Compare July 1, 2026 19:04
@sepointon

Copy link
Copy Markdown
Contributor Author

Urgh, this might also want a Firefox build to make sure I'm not breaking it...

@sepointon sepointon mentioned this pull request Jul 1, 2026
3 of 13 tasks
@sepointon
sepointon force-pushed the 2026-07-wasip1-rename branch from 3b6552f to 3dfeeff Compare July 1, 2026 19:36
@nixpkgs-ci nixpkgs-ci Bot added 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. 6.topic: tree-sitter Tree-sitter is a parser generator tool and an incremental parsing library. 8.has: documentation This PR adds or changes documentation labels Jul 1, 2026
@sepointon
sepointon force-pushed the 2026-07-wasip1-rename branch from 3dfeeff to 3f47455 Compare July 1, 2026 19:44
@mweinelt
mweinelt self-requested a review July 1, 2026 19:49
@mweinelt

mweinelt commented Jul 2, 2026

Copy link
Copy Markdown
Member

Breaks Firefox.

1:06.07 Using wasi sysroot in /nix/store/p6caa6z4cc8iq64ba7frb6f3fd5mcpjp-wasi-sysroot
 1:06.07 checking for the wasm C compiler... /nix/store/yvn4ycgnv8lgdikj2a61dm91wl9ag4vg-wasm32-unknown-wasip1-clang-wrapper-21.1.8/bin/wasm32-unknown-wasip1-cc
 1:06.17 checking whether the wasm C compiler can be used... yes
 1:06.17 checking the wasm C compiler version... 21.1.8
 1:06.23 checking the wasm C compiler works... yes
 1:06.29 checking the wasm C compiler can find wasi headers... yes
 1:06.41 checking the wasm C linker can find wasi libraries... yes
 1:06.41 checking for the wasm C++ compiler... /nix/store/yvn4ycgnv8lgdikj2a61dm91wl9ag4vg-wasm32-unknown-wasip1-clang-wrapper-21.1.8/bin/wasm32-unknown-wasip1-c++
 1:06.57 checking whether the wasm C++ compiler can be used... yes
 1:06.57 checking the wasm C++ compiler version... 21.1.8
 1:06.63 checking the wasm C++ compiler works... yes
 1:06.69 checking the wasm C++ compiler can find wasi headers... yes
 1:06.82 checking the wasm C++ linker can find wasi libraries...
 1:06.82 DEBUG: Creating `/build/conftestnbosqhyp.cpp` with content:
 1:06.82 DEBUG: | int
 1:06.82 DEBUG: | main(void)
 1:06.82 DEBUG: | {
 1:06.82 DEBUG: |
 1:06.82 DEBUG: |   ;
 1:06.82 DEBUG: |   return 0;
 1:06.82 DEBUG: | }
 1:06.82 DEBUG: Executing: `/nix/store/yvn4ycgnv8lgdikj2a61dm91wl9ag4vg-wasm32-unknown-wasip1-clang-wrapper-21.1.8/bin/wasm32-unknown-wasip1-c++ -std=gnu++20 /build/conftestnbosqhyp.cpp --sysroot=/nix/store/p6caa6z4cc8iq64ba7frb6f3fd5mcpjp-wasi-sysroot`
 1:06.82 DEBUG: The command returned non-zero exit status 1.
 1:06.82 DEBUG: Its error output was:
 1:06.82 DEBUG: | wasm-ld: error: unable to find library -lc++
 1:06.82 DEBUG: | wasm-ld: error: unable to find library -lc++abi
 1:06.82 DEBUG: | clang++: error: linker command failed with exit code 1 (use -v to see invocation)
 1:06.82 ERROR: Cannot find wasi libraries or problem with the wasm linker. Please fix the problem. Or build with --without-wasm-sandboxed-libraries.
 1:06.98 E *** Fix above errors and then restart with "./mach build"

@sepointon
sepointon force-pushed the 2026-07-wasip1-rename branch from 3f47455 to 8837975 Compare July 2, 2026 08:22
@sepointon

Copy link
Copy Markdown
Contributor Author

Thanks - actually, that's early enough, in configurePhase, that I can hit it myself, so that's fixed and now firefox-unwrapped gets into buildPhase.

@sepointon
sepointon force-pushed the 2026-07-wasip1-rename branch from 8837975 to 5c57d14 Compare July 2, 2026 11:14
@mweinelt

mweinelt commented Jul 2, 2026

Copy link
Copy Markdown
Member

Tested Firefox ESR/Rapid across aarch64-linux and x86_64-linux.

@sepointon
sepointon force-pushed the 2026-07-wasip1-rename branch from 5c57d14 to 8b6815c Compare July 28, 2026 07:30
@nixpkgs-ci nixpkgs-ci Bot added the 8.has: changelog This PR adds or changes release notes label Jul 28, 2026
@sepointon

Copy link
Copy Markdown
Contributor Author

I've chucked a release note on, and this idea has suddenly gained a dependent in the LLVM 22 work. I've let this sit for a few weeks and nothing in that time's made me think it's not ready for merging.


`buildGrammar` builds a native `$out/parser`.
To build grammars as WebAssembly instead, use the `wasi32` cross package set, which installs `$out/parser.wasm`:
To build grammars as WebAssembly instead, use the `wasim32-wasip1` cross package set, which installs `$out/parser.wasm`:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
To build grammars as WebAssembly instead, use the `wasim32-wasip1` cross package set, which installs `$out/parser.wasm`:
To build grammars as WebAssembly instead, use the `wasm32-wasip1` cross package set, which installs `$out/parser.wasm`:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Poor Wasim has to be denied his chance at fame.

@nixpkgs-ci nixpkgs-ci Bot added 2.status: merge conflict This PR has merge conflicts with the target branch 12.approvals: 1 This PR was reviewed and approved by one person. labels Jul 28, 2026
Wasi P2 is different enough to Wasi P1 to warrant being treated entirely 
separately, rather than as two minor variants of the same thing. P3 will 
likewise want to be a different target.

I've left aliases in place; maybe eventually, those can be deprecated 
and removed. I've tested this, but it's possible there might be breakage 
somewhere (e.g., the canonical doubles for P1 have changed, though I 
can't imagine why anyone would rely on that).

Fixes NixOS#435954
@philiptaron

Copy link
Copy Markdown
Contributor

Sadly needs merge conflicts fixed up; I'm planning on merging it after that baring a late-breaking 👎 from my collaborators.

@sepointon
sepointon force-pushed the 2026-07-wasip1-rename branch from 8b6815c to 282a7d6 Compare July 28, 2026 18:53
@sepointon

Copy link
Copy Markdown
Contributor Author

Rebased and pushed (and I think I put the relnote in the correct file this time).

@nixpkgs-ci nixpkgs-ci Bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Jul 28, 2026
@philiptaron
philiptaron added this pull request to the merge queue Jul 28, 2026
@philiptaron

Copy link
Copy Markdown
Contributor

I built and tested Firefox.

Merged via the queue into NixOS:master with commit e9b15da Jul 28, 2026
24 checks passed
@sepointon

Copy link
Copy Markdown
Contributor Author

Thanks!

@mightyiam

Copy link
Copy Markdown
Member

So, there's no eval warning?

@niklaskorz

Copy link
Copy Markdown
Member

So, there's no eval warning?

Hm we don't have eval warnings for any other system aliases so far... But I agree this one might be worth pointing out.
(also at least one other alias says it should warn by now but does not: https://github.com/sepointon/nixpkgs/blob/282a7d66b62715a22cd69caaee7bcac4a63e7aae/lib/systems/examples.nix#L394)

@sepointon

Copy link
Copy Markdown
Contributor Author

A warning for the target triple could be a good idea. I doubt that wasm32-wasi will become possible to use for Wasi 1.0 due to too much risk of confusion with legacy use from p1 (either in Nixpkgs or more generally), but to try and avoid people accidentally stumbling into using p1 when they meant something else it's probably got value. That said, I don't think I'll implement it myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: lib The Nixpkgs function library 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. 6.topic: tree-sitter Tree-sitter is a parser generator tool and an incremental parsing library. 8.has: changelog This PR adds or changes release notes 8.has: documentation This PR adds or changes documentation 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

Archived in project
Status: Done

Development

Successfully merging this pull request may close these issues.

Move wasi32 system to wasm32-wasip1 target

6 participants