generated from saji/ecp5-template
flake now works with pyproject and flake-parts
This commit is contained in:
parent
20054ad034
commit
79927f0cbd
44
flake.lock
44
flake.lock
|
@ -1,29 +1,32 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
"nixpkgs-lib": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1726560853,
|
||||
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
|
||||
"lastModified": 1726153070,
|
||||
"narHash": "sha256-HO4zgY0ekfwO5bX0QH/3kJ/h4KvUDFZg8YpkNwIbg1U=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "bcef6817a8b2aa20a5a6dbb19b43e63c5bf8619a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "flake-utils",
|
||||
"type": "indirect"
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1723637854,
|
||||
"narHash": "sha256-med8+5DSWa2UnOqtdICndjDAEjxr5D7zaIiK4pn0Q7c=",
|
||||
"lastModified": 1726937504,
|
||||
"narHash": "sha256-bvGoiQBvponpZh8ClUcmJ6QnsNKw0EMrCQJARK3bI1c=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c3aa7b8938b17aebd2deecf7be0636000d62a2b9",
|
||||
"rev": "9357f4f23713673f310988025d9dc261c20e70c6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -35,24 +38,9 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
120
flake.nix
120
flake.nix
|
@ -3,60 +3,82 @@
|
|||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-parts = {
|
||||
url = "github:hercules-ci/flake-parts";
|
||||
inputs.nixpkgs-lib.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = inputs@{ self, nixpkgs, flake-utils, ... }:
|
||||
let
|
||||
python-overlay = import ./python.nix;
|
||||
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 = [
|
||||
python-overlay
|
||||
];
|
||||
}
|
||||
));
|
||||
in {
|
||||
packages = forAllSystems (pkgs: {
|
||||
niar = pkgs.python3.buildPythonPackage {
|
||||
name = "niar";
|
||||
version = pyproject-toml.project.version;
|
||||
src = ./.;
|
||||
pyproject = true;
|
||||
outputs = inputs@{flake-parts, ... }:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
# flake = let
|
||||
# in {
|
||||
# };
|
||||
# devShells."x86_64-linux".default = pkgs.mkShell {
|
||||
# packages = with pkgs; [
|
||||
# (python3.withPackages (pypkgs: with pypkgs; [
|
||||
# amaranth
|
||||
# amaranth-boards
|
||||
# ]))
|
||||
# yosys
|
||||
# nextpnr
|
||||
# # simulators
|
||||
# iverilog
|
||||
# verilator
|
||||
# # support package
|
||||
# trellis
|
||||
# # loader
|
||||
# openfpgaloader
|
||||
# ecpdap # easier to poke probes.
|
||||
# ];
|
||||
# };
|
||||
# };
|
||||
|
||||
build-system = [pkgs.python3.pdm-backend];
|
||||
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ];
|
||||
|
||||
propagatedBuildInpusts = [
|
||||
pkgs.python3.amaranth
|
||||
pkgs.python3.amaranth-boards
|
||||
];
|
||||
perSystem = {config, self', inputs', pkgs, system, ...}: {
|
||||
packages.default = pkgs.python3.pkgs.buildPythonPackage {
|
||||
name = "groovylight";
|
||||
version = "0.0.1";
|
||||
src = ./.;
|
||||
format = "pyproject";
|
||||
|
||||
doCheck = true;
|
||||
nativeCheckInputs = [python3.pkgs.pytestCheckHook];
|
||||
build-system = [pkgs.python3.pkgs.pdm-backend];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
pkgs.python3.pkgs.amaranth
|
||||
pkgs.python3.pkgs.amaranth-boards
|
||||
];
|
||||
|
||||
doCheck = true;
|
||||
nativeCheckInputs = with pkgs; [
|
||||
python3.pkgs.pytestCheckHook
|
||||
yosys
|
||||
nextpnr
|
||||
trellis
|
||||
openfpgaloader
|
||||
];
|
||||
|
||||
};
|
||||
devShells.default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
(python3.withPackages (pypkgs: with pypkgs; [
|
||||
amaranth
|
||||
amaranth-boards
|
||||
]))
|
||||
self'.packages.default
|
||||
yosys
|
||||
nextpnr
|
||||
# simulators
|
||||
iverilog
|
||||
verilator
|
||||
# support package
|
||||
trellis
|
||||
# loader
|
||||
openfpgaloader
|
||||
ecpdap # easier to poke probes.
|
||||
];
|
||||
};
|
||||
};
|
||||
});
|
||||
devShells = forAllSystems (pkgs: {
|
||||
default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
(python3.withPackages (pypkgs: with pypkgs; [
|
||||
amaranth
|
||||
amaranth-boards
|
||||
]))
|
||||
yosys
|
||||
nextpnr
|
||||
# simulators
|
||||
iverilog
|
||||
verilator
|
||||
# support package
|
||||
trellis
|
||||
# loader
|
||||
openfpgaloader
|
||||
ecpdap # easier to poke probes.
|
||||
];
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
@ -13,6 +13,10 @@ requires-python = "==3.12.*"
|
|||
readme = "README.md"
|
||||
license = {text = "MIT"}
|
||||
|
||||
[build-system]
|
||||
requires = ["pdm-backend"]
|
||||
build-backend = "pdm.backend"
|
||||
|
||||
[tool.pdm.dev-dependencies]
|
||||
dev = [
|
||||
"basedpyright",
|
||||
|
|
Loading…
Reference in a new issue