forked from Yehowshua/RiscV-Formal

``` [nix-shell:~/joyofhardware/RiscV-Formal]$ riscv64-unknown-linux-gnu-gcc bash: /nix/store/xq4q2vv9ii7z2k2qp82jd180xdb0r4fv-gcc-riscv64-unknown-linux-gnu-14-20241116/bin/riscv64-unknown-linux-gnu-gcc: cannot execute binary file: Exec format error ``` `pkgs.pkgsCross.riscv64` is for running on riscv64 `pkgs.pkgsCross.riscv64.buildPackages` is for running on the build system and compiling code for riscv64 `nativeBuildInputs` is for packages which run on the build system and compile code for riscv64 with `__splicedPackages` we can avoid having to specify `buildPackages` and have the dependency attributes (`nativeBuildInputs`) pick the `buildHost` version of the package
17 lines
310 B
Nix
17 lines
310 B
Nix
{ pkgs ? import <nixpkgs> {} }:
|
|
|
|
let
|
|
riscv64-linux = pkgs.pkgsCross.riscv64.__splicedPackages;
|
|
in
|
|
pkgs.mkShell {
|
|
nativeBuildInputs = [
|
|
riscv64-linux.gcc
|
|
riscv64-linux.binutils
|
|
riscv64-linux.glibc
|
|
];
|
|
|
|
shellHook = ''
|
|
echo "RISC-V Linux cross-compilation environment initialized!"
|
|
'';
|
|
}
|