groovylight/flake.nix

91 lines
2.2 KiB
Nix
Raw Permalink Normal View History

2024-04-19 15:13:39 +00:00
{
description = "ECP5 toolchain template project";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
2024-09-26 06:45:57 +00:00
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
2024-04-19 15:13:39 +00:00
};
2024-09-26 06:45:57 +00:00
outputs =
2024-09-26 15:33:41 +00:00
inputs@{ self, flake-parts, ... }:
2024-09-26 06:45:57 +00:00
flake-parts.lib.mkFlake { inherit inputs; } {
2024-09-26 15:33:41 +00:00
flake = {
overlays.default = import ./python.nix;
};
2024-09-22 15:55:52 +00:00
2024-09-26 06:45:57 +00:00
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
2024-09-25 01:52:44 +00:00
2024-09-26 06:45:57 +00:00
perSystem =
{
config,
self',
inputs',
pkgs,
system,
2024-09-26 15:33:41 +00:00
...
2024-09-26 06:45:57 +00:00
}:
2024-09-26 14:40:45 +00:00
let
toolchain-pkgs = with pkgs; [
yosys
nextpnr
trellis
openfpgaloader
];
in
2024-09-26 06:45:57 +00:00
{
2024-09-26 15:33:41 +00:00
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = [self.overlays.default];
config.allowUnfree = true;
};
2024-09-26 06:45:57 +00:00
formatter = pkgs.nixfmt-rfc-style;
packages.default = pkgs.python3.pkgs.buildPythonPackage {
name = "groovylight";
version = "0.0.1";
src = ./.;
format = "pyproject";
2024-09-25 01:52:44 +00:00
2024-09-26 06:45:57 +00:00
build-system = [ pkgs.python3.pkgs.pdm-backend ];
2024-09-26 06:45:57 +00:00
propagatedBuildInputs = [
pkgs.python3.pkgs.amaranth
pkgs.python3.pkgs.amaranth-boards
];
2024-09-26 06:45:57 +00:00
doCheck = true;
2024-09-26 15:33:41 +00:00
dontCheckRuntimeDeps = 1; # nightly amaranth doesn't pass
2024-09-26 14:40:45 +00:00
nativeCheckInputs =
with pkgs;
[
python3.pkgs.pytestCheckHook
]
++ toolchain-pkgs;
2024-09-26 06:45:57 +00:00
};
devShells.default = pkgs.mkShell {
2024-09-26 14:40:45 +00:00
packages =
with pkgs;
[
(python3.withPackages (
pypkgs: with pypkgs; [
amaranth
amaranth-boards
self'.packages.default
]
))
ecpdap # easier to poke probes.
]
++ toolchain-pkgs;
2024-09-26 06:45:57 +00:00
};
};
};
2024-04-19 15:13:39 +00:00
}