-
Notifications
You must be signed in to change notification settings - Fork 2
/
flake.nix
82 lines (76 loc) · 2.07 KB
/
flake.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs =
{ self, nixpkgs, ... }:
{
devShells.x86_64-linux =
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
patchGccStdenv =
pkgs: stdenv:
pkgs.overrideCC stdenv (
pkgs.wrapCC (
stdenv.cc.cc.overrideAttrs (final: prev: { patches = prev.patches ++ [ ./fix-gcc-ice.patch ]; })
)
);
crossSystem = {
config = "riscv32-none-none-elf";
gcc = {
abi = "ilp32";
arch = "rv32i";
};
};
localSystem = "x86_64-linux";
rv32CrossPkgs = import nixpkgs {
inherit localSystem crossSystem;
};
rv32LLVMCrossPkgs = import nixpkgs {
inherit localSystem;
crossSystem = crossSystem // {
useLLVM = true;
};
};
bareClangStdenv =
with rv32LLVMCrossPkgs;
overrideCC clangStdenv buildPackages.llvmPackages.clangNoLibc;
nemuDepsBuildBuild = with pkgs; [
gnumake
SDL2
pkg-config
bison
flex
ncurses
readline
libllvm
gcc
clang
];
in
rec {
nemu = rv32CrossPkgs.mkShell {
name = "openperf";
depsBuildBuild = nemuDepsBuildBuild;
CROSS_COMPILE = "riscv32-none-none-elf-";
};
nemu-clang = bareClangStdenv.mkDerivation {
name = "openperf";
depsBuildBuild = nemuDepsBuildBuild;
};
native =
pkgs.mkShell.override
{
stdenv = patchGccStdenv pkgs pkgs.stdenv;
}
{
name = "openperf";
buildInputs = with pkgs; [
gnumake
SDL2
];
};
riscv32-nemu = nemu;
};
};
}