Add support for riscv64-linux#172
Conversation
It's supported in upstream Nix, and some projects like `k3s-io/k3s` are running into its lack of support in this project [1] [1] k3s-io/k3s#13854
✅ Deploy Preview for detsys-ts-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 WalkthroughWalkthroughThe changes add support for the RISCV64-Linux platform by extending the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/platform.ts (1)
27-47: Consider adding unit tests for the platform mappings ingetNixPlatform.The
RISCV64-Linux→riscv64-linuxmapping lacks test coverage. Add tests to verify that all platform mappings, including the new RISCV64-Linux entry, are correctly converted.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/platform.ts` around lines 27 - 47, Add unit tests for getNixPlatform to assert that each entry in archOsMap (e.g., "X64-macOS" => "x86_64-darwin", "ARM64-macOS" => "aarch64-darwin", "X64-Linux" => "x86_64-linux", "ARM64-Linux" => "aarch64-linux", and the new "RISCV64-Linux" => "riscv64-linux") returns the expected Nix platform string, and add a test that an unknown archOs value causes the function to throw an Error (verifying the thrown message or type); locate the function by name getNixPlatform and the mapping variable archOsMap when adding the tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@flake.nix`:
- Line 17: The flake's supportedSystems list currently includes "riscv64-linux",
which causes evaluation failures; update the supportedSystems declaration in
flake.nix to remove "riscv64-linux" or wrap the list with a conditional/filter
to exclude riscv64 variants (e.g., use builtins.filter or a small predicate) so
that outputs like formatter and devShells are not evaluated for riscv64-linux;
locate the supportedSystems symbol in flake.nix and either delete the
"riscv64-linux" entry or modify the expression to exclude entries that match
"riscv64-linux" before exporting.
---
Nitpick comments:
In `@src/platform.ts`:
- Around line 27-47: Add unit tests for getNixPlatform to assert that each entry
in archOsMap (e.g., "X64-macOS" => "x86_64-darwin", "ARM64-macOS" =>
"aarch64-darwin", "X64-Linux" => "x86_64-linux", "ARM64-Linux" =>
"aarch64-linux", and the new "RISCV64-Linux" => "riscv64-linux") returns the
expected Nix platform string, and add a test that an unknown archOs value causes
the function to throw an Error (verifying the thrown message or type); locate
the function by name getNixPlatform and the mapping variable archOsMap when
adding the tests.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ce67305a-0fd4-4a47-89e9-dc99e43494af
⛔ Files ignored due to path filters (2)
dist/index.mjsis excluded by!**/dist/**dist/index.mjs.mapis excluded by!**/dist/**,!**/*.map
📒 Files selected for processing (2)
flake.nixsrc/platform.ts
| supportedSystems = [ | ||
| "x86_64-linux" | ||
| "aarch64-linux" | ||
| "riscv64-linux" |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
Does nixpkgs support riscv64-linux platform and are Node.js packages available for it?
💡 Result:
Yes, nixpkgs supports the riscv64-linux platform at a basic level, with stdenv bootstrapping and platform definitions in lib/systems. It is listed in flake-systems.nix as a supported system and examples.nix defines riscv64-linux. However, NixOS has no official support for riscv64-linux on nixpkgs-unstable or stable channels, and there is no official Hydra binary cache (community caches like cache.ztier.in exist for unstable). Builds are possible but often fail for many packages, including coreutils and nodejs. Node.js packages are defined generically in nixpkgs and can be built for riscv64-linux in principle (nodejs.nix uses stdenv.hostPlatform.node.arch, which supports riscv64 per Node.js BUILDING.md listing riscv64 as experimental). However, native builds fail (Issue #374456 open as of 2025, brotli compilation error), and no prebuilt binaries are available in official caches. Users may need third-party builds or cross-compilation.
Citations:
- 1: Build failure: coreutils (riscv64-linux) NixOS/nixpkgs#294775
- 2: stdenv: bootstrap riscv64-linux (Step 1) NixOS/nixpkgs#115406
- 3: https://wiki.nixos.org/wiki/RISC-V
- 4: Build failure: nodejs on RISC-V (RV64GC) NixOS/nixpkgs#374456
- 5: https://search.nixos.org/packages?query=nodejs&type=packages
- 6: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/web/nodejs/nodejs.nix
- 7: https://github.com/NixOS/nixpkgs/blob/master/lib/systems/examples.nix
- 8: grafana: add riscv64-linux platform NixOS/nixpkgs#489731
- 9: https://github.com/NixOS/nixpkgs/blob/master/lib/systems/flake-systems.nix
- 10: https://github.com/NixOS/nixpkgs/blob/master/lib/systems/doubles.nix
Remove riscv64-linux from supportedSystems or conditionally exclude its derivatives.
Adding riscv64-linux to supportedSystems will cause flake evaluation to fail for this platform. While nixpkgs defines riscv64-linux in its platform registry, NixOS has no official support for it on nixpkgs-unstable or stable channels, and there is no official binary cache. Critically, Node.js native builds fail for riscv64-linux due to an unresolved brotli compilation error (nixpkgs issue #374456), and no prebuilt binaries are available. The flake's formatter and devShells outputs will not be evaluable for this platform without third-party or cross-compilation workarounds that are not in place here.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@flake.nix` at line 17, The flake's supportedSystems list currently includes
"riscv64-linux", which causes evaluation failures; update the supportedSystems
declaration in flake.nix to remove "riscv64-linux" or wrap the list with a
conditional/filter to exclude riscv64 variants (e.g., use builtins.filter or a
small predicate) so that outputs like formatter and devShells are not evaluated
for riscv64-linux; locate the supportedSystems symbol in flake.nix and either
delete the "riscv64-linux" entry or modify the expression to exclude entries
that match "riscv64-linux" before exporting.
|
I stand corrected, the support for Nix isn't there yet on |
Description
It's supported in upstream Nix, and some projects like
k3s-io/k3sare running into its lack of support in this project [1][1] k3s-io/k3s#13854
Checklist
Summary by CodeRabbit