Skip to content

Commit 4aea408

Browse files
committed
repo: removed shell.nix and moved to nix flakes
1 parent ac2f4f2 commit 4aea408

File tree

5 files changed

+128
-42
lines changed

5 files changed

+128
-42
lines changed

.bazelignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# While using flakes, bazel might pickup the sources used
2+
# as flake input stored in direnv and lead to a broken build.
3+
.direnv

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ It has been tested with the Artix-7 [counter example][counter-example], where it
1010

1111
## Usage
1212

13-
First, install [Bazel][bazel] and ensure you have a basic C/C++ toolchain set up. Then run:
13+
First, install [Bazel][bazel] and ensure you have a basic C/C++ toolchain set up.
14+
15+
> [!NOTE]
16+
> If you are using Nix or NixOS, ensure you have [flakes enabled][enable-flakes] and enter the devShell via `nix develop`.
17+
18+
Then run:
1419

1520
```
1621
bazel run -c opt //fpga:fpga-as -- --prjxray_db_path=/some/path/prjxray-db/artix7 --part=xc7a35tcsg324-1 < /some/path.fasm > output.bit
@@ -66,3 +71,4 @@ Using this metadata, you can search the segbits database for the specific featur
6671
[bazel]: https://bazel.build/
6772
[counter-example]: https://github.com/chipsalliance/f4pga-examples/blob/13f11197b33dae1cde3bf146f317d63f0134eacf/xc7/counter_test/counter.v
6873
[open-fpga-loader]: https://github.com/trabucayre/openFPGALoader
74+
[enable-flakes]: https://nixos.wiki/wiki/Flakes#Enable_flakes_permanently_in_NixOS

flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
description = "fpga-assembler";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs = { self, nixpkgs, flake-utils }:
10+
flake-utils.lib.eachDefaultSystem (system:
11+
let
12+
pkgs = import nixpkgs {
13+
inherit system;
14+
};
15+
in {
16+
devShells.default =
17+
let
18+
bazel = pkgs.bazel_7;
19+
20+
# There is too much volatility between even micro-versions of
21+
# newer clang-format. Use slightly older version for now.
22+
clang_for_formatting = pkgs.llvmPackages_17.clang-tools;
23+
24+
# clang tidy: use latest.
25+
clang_for_tidy = pkgs.llvmPackages_18.clang-tools;
26+
in with pkgs; pkgs.mkShell{
27+
packages = with pkgs; [
28+
git
29+
bazel
30+
jdk
31+
bash
32+
gdb
33+
34+
# For clang-tidy and clang-format.
35+
clang_for_formatting
36+
clang_for_tidy
37+
38+
# For buildifier, buildozer.
39+
bazel-buildtools
40+
bant
41+
42+
# Profiling and sanitizers.
43+
linuxPackages_latest.perf
44+
pprof
45+
perf_data_converter
46+
valgrind
47+
48+
# FPGA utils.
49+
openfpgaloader
50+
];
51+
52+
CLANG_TIDY="${clang_for_tidy}/bin/clang-tidy";
53+
CLANG_FORMAT="${clang_for_formatting}/bin/clang-format";
54+
};
55+
}
56+
);
57+
}

shell.nix

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)