Package LLVM, MLIR, and CIRCT and related projects using nix + flakes.
Available packages:
- circt - CIRCT
- mlir - MLIR (built using LLVM version pinned by CIRCT)
- slang - SystemVerilog compiler and language services
For a list of all outputs, see nix flake show circt
(after adding to registry, see below).
Only x86_64-linux has been tested.
Built with assertions enabled.
This requires nix
, preferably with flake support.
Flake support is assumed throughout,
to use without flakes see Without Flakes.
Clone repository locally if you would like to make changes to it, but otherwise no installation required.
Use the dtz-circt cachix to use prebuilt paths when available.
Follow the instructions at that link,
or install cachix yourself and run cachix use dtz-circt
.
Either refer to this flake as github:dtzSiFive/circt-nix
,
or optionally add this to your flake registry for simpler invocations:
$ nix registry add circt github:dtzSiFive/circt-nix
For brevity's sake, the remaining commands will assume this has been added to your registry, but if not use the longer reference.
Registry entries can be pinned with nix registry pin
.
$ nix build circt
$ ./result/bin/firtool --help
Prebuilt versions may be available via cachix, but if not (or not using it) this will build LLVM, MLIR, and CIRCT (separately).
nix profile
is experimental, but works natively with flakes.
In addition to simpler installation procedure (of CIRCT),
since nix profile
tracks installation origin details,
it's easy to upgrade your CIRCT installation
when updates to this repository are made.
$ nix profile install circt
See Without Flakes.
This repo also provides a development shell for work on CIRCT.
To use:
$ nix develop circt
Or with nix-direnv:
$ echo "use flake circt" >> /path/to/circt-src/.envrc
So that the environment is automatically loaded/unloaded when cd'ing to that directory.
Compatibility with non-flakes nix is provided for use with non-flakes tools,
such as with nix-env
.
Generally speaking, point the command at this repository usually with:
-f https://github.com/dtzSiFive/circt-nix/archive/master.tar.gz
$ nix-env -f https://github.com/dtzSiFive/circt-nix/archive/master.tar.gz -iA default
$ nix-build https://github.com/dtzSiFive/circt-nix/archive/master.tar.gz -A default