-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathflake.nix
More file actions
147 lines (129 loc) · 4.47 KB
/
flake.nix
File metadata and controls
147 lines (129 loc) · 4.47 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
{
description = "Development environment for Buckyball with Verilator";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }@inputs:
flake-utils.lib.eachDefaultSystem
(system:
let
overlay = import ./scripts/nix/overlay.nix;
pkgs = import nixpkgs { overlays = [ overlay ]; inherit system; };
in
{
legacyPackages = pkgs;
# nix build
packages.default = pkgs.buildEnv {
name = "buckyball-environment";
paths = with pkgs; [
tools.verilator
tools.dramsim2
tools.ccache
tools.lld
tools.cmake
tools.java
tools.dtc
tools.spike
tools.yosys
tools.opensta
tools.lcov
# RISC-V toolchain
riscv.riscv-embedded-gcc
riscv.riscv-linux-gcc
# python environment
python.python3Packages
pkgs."pre-commit"
pkgs.clang-tools # clang-format for pre-commit (language: system)
# Rust toolchain
rustTools.rustc
rustTools.cargo
rustTools.rustfmt
rustTools.clippy
# bbdev dependencies
bbdev.iii
bbdev.uv
bbdev.allure
bbdev.gcc
bbdev.gnumake
bbdev.pkg-config
# Kernel build tools (RISC-V kernel + rootfs for Pegasus)
kernel.e2fsprogs
# C libraries (headers + link libs)
clibs.zlib-dev
clibs.zlib
clibs.readline-dev
clibs.readline
clibs.jpeg-dev
clibs.jpeg
clibs.png-dev
clibs.png
clibs.elfutils-dev
clibs.elfutils
# Compiler tools
compiler.flatbuffers
compiler.numactl
# Scala tools
scala.mill
scala.sbt
scala.scalafmt
scala.coursier
# Documentation tools
doc.mdbook
doc.mdbook-linkcheck
doc.mdbook-pdf
doc.mdbook-toc
doc.mdbook-mermaid
# System utilities
systemTools.rsync
systemTools.nodejs
systemTools.git
# systemTools.npm
];
};
# nix develop
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
clibs.zlib-dev
clibs.zlib
clibs.readline-dev
clibs.readline
clibs.jpeg-dev
clibs.jpeg
clibs.png-dev
clibs.png
clibs.elfutils-dev
clibs.elfutils
compiler.flatbuffers
compiler.numactl
];
shellHook = ''
if [ -d "$PWD/result/bin" ]; then
export PATH="$PWD/result/bin:$PATH"
else
echo "Warning: result/bin not found. Run 'nix build' first." >&2
fi
source "$PWD/sourceme.sh"
# Verilator build acceleration: ccache via OBJCACHE
export OBJCACHE=ccache
if [ -z "$NIX_QUIET" ]; then
echo "================= Buckyball Environment Activated ========================="
echo "Development environment loaded:"
echo "Verilator: $(verilator --version 2>&1 | head -1)"
echo "RISC-V Embedded GCC: $(riscv64-unknown-elf-gcc --version 2>&1 | head -1)"
echo "RISC-V Linux GCC: $(riscv64-unknown-linux-gnu-gcc --version 2>&1 | head -1)"
echo "Mill: $(mill --version 2>&1 | head -1)"
echo "Cargo: $(cargo --version 2>&1 | head -1)"
echo "npm: $(npm --version 2>&1 | head -1)"
echo "bbdev: $(which bbdev)"
echo "RISCV: $RISCV"
echo "Yosys: $(yosys --version 2>&1 | head -1)"
echo "OpenSTA: $(sta -version 2>&1 | head -1)"
echo "Buddy MLIR: $(which buddy-opt)"
echo "==========================================================================="
fi
'';
};
}
);
}