Skip to content

Add support for riscv64-linux#172

Draft
luhenry wants to merge 1 commit into
DeterminateSystems:mainfrom
luhenry:main
Draft

Add support for riscv64-linux#172
luhenry wants to merge 1 commit into
DeterminateSystems:mainfrom
luhenry:main

Conversation

@luhenry
Copy link
Copy Markdown

@luhenry luhenry commented Apr 17, 2026

Description

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

Checklist
  • Tested changes against a test repository
  • Added or updated relevant documentation (leave unchecked if not applicable)
  • (If this PR is for a release) Updated README to point to the new tag (leave unchecked if not applicable)

Summary by CodeRabbit

  • New Features
    • Added support for RISC-V 64-bit Linux platform architecture.

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
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 17, 2026

Deploy Preview for detsys-ts-docs ready!

Name Link
🔨 Latest commit 9db792f
🔍 Latest deploy log https://app.netlify.com/projects/detsys-ts-docs/deploys/69e23aa53ef22c0008fd785c
😎 Deploy Preview https://deploy-preview-172--detsys-ts-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 17, 2026

📝 Walkthrough

Walkthrough

The changes add support for the RISCV64-Linux platform by extending the supportedSystems list in the Nix flake configuration and introducing the corresponding architecture-to-platform mapping in the platform detection module.

Changes

Cohort / File(s) Summary
RISCV64 Platform Support
flake.nix, src/platform.ts
Added RISCV64-Linux as a supported system platform in the Nix flake configuration and implemented the corresponding architecture/OS mapping from RISCV64-Linux to the Nix platform identifier riscv64-linux.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A hoppy new era hops into view,
RISCV64 joins the blessed crew,
From flake to platform maps it springs,
One simple mapping—oh, what it brings! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title directly and accurately summarizes the main change: adding support for riscv64-linux platform. Both file changes (flake.nix and src/platform.ts) are focused on this single objective.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/platform.ts (1)

27-47: Consider adding unit tests for the platform mappings in getNixPlatform.

The RISCV64-Linuxriscv64-linux mapping 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

📥 Commits

Reviewing files that changed from the base of the PR and between 726a3af and 9db792f.

⛔ Files ignored due to path filters (2)
  • dist/index.mjs is excluded by !**/dist/**
  • dist/index.mjs.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (2)
  • flake.nix
  • src/platform.ts

Comment thread flake.nix
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"riscv64-linux"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 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:


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.

@luhenry luhenry marked this pull request as draft April 17, 2026 13:57
@luhenry
Copy link
Copy Markdown
Author

luhenry commented Apr 17, 2026

I stand corrected, the support for Nix isn't there yet on riscv64-linux. Let me check further and reopen or close accordingly.

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.

1 participant