!xmLtiCaAJxfhURjrXl:matrix.org

NixOS RISC-V

237 Members
NixOS on RISC-V https://wiki.nixos.org/wiki/RISC-V https://pad.lassul.us/NixOS-riscv64-linux https://github.com/orgs/NixOS/teams/risc-v69 Servers

Load older messages


SenderMessageTime
15 Apr 2026
@blokyk:matrix.orgzoë (@blokyk) * i'm not sure if this is the right place to ask, especially because this is a very noob question, but i'm trying to get a shell for doing cross-compilation from x86 to riscv. I thought it'd be a simple matter of getting a pkgsCross.riscv32.mkShell/stdenv with the right nativeBuildInputs etc, but if i do nix-shell -p pkgsCross.riscv32.stdenv, I just get an x86->x86 toolchain (which cc points to a nix-managed gcc, but for x86)... where's the problem with my mental model, and how can i get a shell with the right environment? 10:01:19
@blokyk:matrix.orgzoë (@blokyk) * i'm not sure if this is the right place to ask, especially because this is a very noob question, but i'm trying to get a shell for doing cross-compilation from x86 to riscv. I thought it'd be a simple matter of getting a pkgsCross.riscv32.stdenv/mkShell with the right nativeBuildInputs etc, but if i do nix-shell -p pkgsCross.riscv32.stdenv, I just get an x86->x86 toolchain (which cc points to a nix-managed gcc, but for x86)... where's the problem with my mental model, and how can i get a shell/derivation environment with the right toolchain? 10:12:44
@blokyk:matrix.orgzoë (@blokyk) * i'm not sure if this is the right place to ask, especially because this is a very noob question, but i'm trying to get a shell for doing cross-compilation from x86 to riscv. I thought it'd be a simple matter of getting a pkgsCross.riscv32.stdenv/mkShell with the right nativeBuildInputs etc, but if i do nix-shell -p pkgsCross.riscv32.stdenv, I just get an x86->x86 toolchain (which cc points to a nix-managed gcc, but for x86)... where's the problem with my mental model, and how can i get a shell/derivation environment with the right toolchain?
(ideally i'd also like to get an llvm-based toolchain, but that seems like it's basically completely unsupported)
10:14:20
@blokyk:matrix.orgzoë (@blokyk) * i'm not sure if this is the right place to ask, especially because this is a very noob question, but i'm trying to get a shell for doing cross-compilation from x86 to riscv. I thought it'd be a simple matter of getting a pkgsCross.riscv32.stdenv/mkShell with the right nativeBuildInputs etc, but if i do nix-shell -p pkgsCross.riscv32.stdenv, I just get an x86->x86 toolchain (which cc points to a nix-managed gcc, but for x86)... where's the problem with my mental model, and how can i get a shell/derivation environment with the right toolchain?
(ideally i'd also like to get an llvm-based toolchain, but that seems like it's basically completely unsupported ;-;)
10:14:27
@blokyk:matrix.orgzoë (@blokyk) * i'm not sure if this is the right place to ask, especially because this is a very noob question, but i'm trying to get a shell for doing cross-compilation from x86 to riscv. I thought it'd be a simple matter of getting a pkgsCross.riscv32.stdenv/mkShell with the right nativeBuildInputs etc, but if i do nix-shell -p pkgsCross.riscv32.stdenv, I just get an x86->x86 toolchain (which cc points to a nix-managed gcc, but for x86)... where's the problem with my mental model, and how can i get a shell/derivation environment with the right toolchain?
(ideally i'd also like to get an llvm-based toolchain, but that seems like it's basically completely unsupported ;-; i mean, compiler-rt-libc-riscv32-unknown-linux-gnu is broken so...)
10:15:21
@blokyk:matrix.orgzoë (@blokyk) hmm, i might just be dumb... i though that .stdenv was basically just like an empty mkDerivation { } but I guess not
also i got confused by mkShell having which cc point to my system's cc, but actually $CC is correct it seems. it's just going to be annoying since some of the stuff i want to use has cc in its makefiles instead of $CC
10:21:25
@blokyk:matrix.orgzoë (@blokyk)Redacted or Malformed Event10:50:43
@blokyk:matrix.orgzoë (@blokyk) *

ok so i wasn't going crazy: trying it out with just nix-shell and hard-coded pkgsCross.riscv32. in front of everything works, but for some reason callPackage/splicing doesn't work :(

# shell.nix
{
  llvmPackages_latest,
  mkShell
}:
let mkLLVMShell = mkShell.override { inherit (llvmPackages_latest) stdenv; }
in
mkLLVMShell { }
10:50:51
@blokyk:matrix.orgzoë (@blokyk) *

ok so i wasn't going crazy: trying it out with just nix-shell and hard-coded pkgsCross.riscv32. in front of everything works, but for some reason callPackage/splicing doesn't work :(

# shell.nix
{
  llvmPackages_latest,
  mkShell
}:
let mkLLVMShell = mkShell.override { inherit (llvmPackages_latest) stdenv; }
in
mkLLVMShell { }
$ nix-shell -E '(import <nixpkgs> {}).pkgsCross.riscv64.callPackage ./shell.nix {}'
[nix-shell:~] $ $CC --version
clang version 22.1.2
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /nix/store/nqrpsik93243zfbysab689b4598x0srw-clang-22.1.2/bin

:(

10:53:55
@blokyk:matrix.orgzoë (@blokyk) *

ok so i wasn't going crazy: trying it out with just nix-shell and hard-coded pkgsCross.riscv32. in front of everything works, but for some reason callPackage/splicing doesn't work :(

# shell.nix
{
  llvmPackages_latest,
  mkShell
}:
let mkLLVMShell = mkShell.override { inherit (llvmPackages_latest) stdenv; }
in
mkLLVMShell { }
$ nix-shell -E '(import <nixpkgs> {}).pkgsCross.riscv64.callPackage ./shell.nix {}'

[nix-shell:~]$ $CC --version
clang version 22.1.2
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /nix/store/nqrpsik93243zfbysab689b4598x0srw-clang-22.1.2/bin

:(

10:54:23
@blokyk:matrix.orgzoë (@blokyk) *

ok so i wasn't going crazy: trying it out with just nix-shell and hard-coded pkgsCross.riscv32. in front of everything works, but for some reason callPackage/splicing doesn't work :(

# shell.nix
{
  llvmPackages_latest,
  mkShell
}:
let mkLLVMShell = mkShell.override { inherit (llvmPackages_latest) stdenv; };
in
mkLLVMShell { }
$ nix-shell -E '(import <nixpkgs> {}).pkgsCross.riscv64.callPackage ./shell.nix {}'

[nix-shell:~]$ $CC --version
clang version 22.1.2
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /nix/store/nqrpsik93243zfbysab689b4598x0srw-clang-22.1.2/bin

:(

10:55:24
@dramforever:matrix.orgdramforever stdenv.cc is the toolchain 13:01:19
@dramforever:matrix.orgdramforeverbut otherwise yeah pkgsCross.riscv32.mkShell should get you what you want13:03:23
@blokyk:matrix.orgzoë (@blokyk)yeah idk what i did, i was just confused13:03:49
@blokyk:matrix.orgzoë (@blokyk)my actual code was more complicated than just an empty mkShell, but working my way back up to it rather than trying to force the existing code into cross-compilation worked better13:05:02
@blokyk:matrix.orgzoë (@blokyk)* my actual nix code was more complicated than just an empty mkShell, but working my way back up to it rather than trying to force the existing nnix code into cross-compilation worked better13:06:44
@alex:tunstall.xyzAlex

cc is never a cross compiler in Nixpkgs. That cc probably comes from pkgsBuildBuild and exists so that builds can compile build tools that they can then use later in the build.

Yes, anything that hardcodes cc (or worse gcc) needs to be patched to support cross.

13:09:08
@rasmata:matrix.org@rasmata:matrix.org joined the room.21:44:25
@rasmata:matrix.org@rasmata:matrix.org left the room.21:44:28
18 Apr 2026
@mlyx:matrix.orgmlyx joined the room.12:39:21
21 Apr 2026
@blokyk:matrix.orgzoë (@blokyk) changed their display name from zoë (she/her) to zoë (@blokyk).03:08:42
23 Apr 2026
@grw00:matrix.orggrw00 joined the room.15:30:57
27 Apr 2026
@cryolitia:matrix.orgPukNgae Cryolitia🏳️‍⚧️4381.jpg
Download 4381.jpg
06:26:44
@cryolitia:matrix.orgPukNgae Cryolitia🏳️‍⚧️4382.jpg
Download 4382.jpg
06:26:45
@cryolitia:matrix.orgPukNgae Cryolitia🏳️‍⚧️successfully boot nixos on emmc on milk-v duo module 0106:27:07
29 Apr 2026
@dramforever:matrix.orgdramforever so uh pkgsCross.riscv64.linux is broken on master 10:50:30
@dramforever:matrix.orgdramforeverthis will be fun10:50:33
@dramforever:matrix.orgdramforeveroh nevermind i got it10:51:10
@dramforever:matrix.orgdramforeveri got mega distracted but it's this https://github.com/NixOS/nixpkgs/pull/51472013:26:53
@jammie:matrix.orgJamieMagee

I ran into an issue while adding RISC-V runner support to nixpkgs-review-gha: https://github.com/Defelo/nixpkgs-review-gha/pull/126#issuecomment-4346267863

error: Cannot build '/nix/store/c9gf76p92n6n4933ilifdxi2npsz6ji0-expand-response-params.drv'.
       Reason: builder failed with exit code 139.
       Output paths:
         /nix/store/pg11yjn6k2p8ciadj750vrq3nndkzlzf-expand-response-params
       Last 7 log lines:
       > Running phase: unpackPhase
       > Running phase: patchPhase
       > Running phase: updateAutotoolsGnuConfigScriptsPhase
       > Running phase: configurePhase
       > no configure script, doing nothing
       > Running phase: buildPhase
       > /nix/store/hf467shdmb2grak3wsw0nb1x8qnn0vw1-bootstrap-stage1-stdenv-linux/setup: line 1769:    30 Segmentation fault         NIX_CC_USE_RESPONSE_FILE=0 "$CC" -std=c99 -O3 -o "expand-response-params" expand-response-params.c

Is this just an incompatibility with the C910 cores in the EM-RV1 boards?

20:43:18

Show newer messages


Back to Room ListRoom Version: 10