99 lines
2.5 KiB
Nix
99 lines
2.5 KiB
Nix
{
|
|
description = "ECP5 toolchain template project";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
treefmt-nix.url = "github:numtide/treefmt-nix";
|
|
};
|
|
|
|
outputs =
|
|
inputs@{
|
|
self,
|
|
nixpkgs,
|
|
treefmt-nix,
|
|
...
|
|
}:
|
|
let
|
|
|
|
systems = [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
"aarch64-darwin"
|
|
"x86_64-darwin"
|
|
];
|
|
forAllSystems =
|
|
function:
|
|
nixpkgs.lib.genAttrs systems (
|
|
system:
|
|
function (
|
|
import nixpkgs {
|
|
inherit system;
|
|
config.allowUnfree = true;
|
|
overlays = [
|
|
self.overlays.default
|
|
];
|
|
}
|
|
)
|
|
);
|
|
litex-pkgs = import ./pkgs;
|
|
|
|
treefmtEval = forAllSystems (pkgs: treefmt-nix.lib.evalModule pkgs ./treefmt.nix);
|
|
in
|
|
{
|
|
overlays.default = final: prev: {
|
|
pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [
|
|
(
|
|
python-final: python-prev:
|
|
builtins.mapAttrs (name: value: python-final.callPackage value { }) litex-pkgs
|
|
)
|
|
];
|
|
};
|
|
|
|
formatter = forAllSystems (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper);
|
|
|
|
checks = forAllSystems (pkgs: {
|
|
formatting = treefmtEval.${pkgs.system}.config.build.check self;
|
|
});
|
|
|
|
# this is mainly so that nix-update works. I have no idea if this works without it.
|
|
# use at your own peril.
|
|
packages = forAllSystems (
|
|
pkgs: builtins.mapAttrs (name: value: pkgs.python3Packages.callPackage value { }) litex-pkgs
|
|
);
|
|
|
|
# example, not really something you should import unless you want everything.
|
|
devShells = forAllSystems (pkgs: {
|
|
default = pkgs.mkShell {
|
|
packages = with pkgs; [
|
|
(python3.withPackages (
|
|
ps: with ps; [
|
|
cocotb
|
|
cocotb-bus
|
|
litex
|
|
litedram
|
|
liteeth
|
|
litescope
|
|
litespi
|
|
liteiclink
|
|
pythondata-cpu-vexriscv
|
|
pythondata-software-compiler_rt
|
|
pythondata-software-picolibc
|
|
amaranth
|
|
]
|
|
))
|
|
yosys
|
|
nextpnr
|
|
# simulators
|
|
verilog
|
|
verilator
|
|
# support package
|
|
trellis
|
|
# loader
|
|
openfpgaloader
|
|
ecpdap # easier to poke probes.
|
|
];
|
|
};
|
|
});
|
|
};
|
|
}
|