-
Notifications
You must be signed in to change notification settings - Fork 8
/
shell.nix
42 lines (37 loc) · 952 Bytes
/
shell.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# This file defines two Nix shells, one with a RISC-V 32-bit toolchain, the
# other is 64-bit. The approach is outlined at
# https://nixos.wiki/wiki/Cross_Compiling.
#
# Usage:
#
# nix-shell --attr riscv32
#
# then use `riscv32-none-elf-gcc` as compiler, or
#
# nix-shell --attr riscv64
#
# then use `riscv64-unknown-linux-gnu-gcc` as compiler.
{ pkgs ? import <nixpkgs> {} }:
let
riscv32-pkgs = import <nixpkgs> {
crossSystem = (import <nixpkgs/lib>).systems.examples.riscv32-embedded;
};
riscv64-pkgs = import <nixpkgs> {
crossSystem = (import <nixpkgs/lib>).systems.examples.riscv64;
};
in
{
riscv32 = riscv32-pkgs.mkShell {
buildInputs = [
];
};
riscv64 = riscv64-pkgs.mkShell {
buildInputs = [
];
nativeBuildInputs = [
# Uncomment to also bring QEMU, if you don't have it system-wide.
# riscv64-pkgs.buildPackages.buildPackages.qemu
riscv64-pkgs.buildPackages.gdb
];
};
}