-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
110 lines (92 loc) · 2.86 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
{
description = "Niar development environment";
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
flake-utils.url = github:numtide/flake-utils;
};
outputs = {
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {inherit system;};
pyproject-toml = pkgs.lib.importTOML ./pyproject.toml;
python = let
packageOverrides = final: prev: {
amaranth = prev.amaranth.overridePythonAttrs {
version = "0.6.0.dev52";
src = pkgs.fetchFromGitHub {
owner = "charlottia";
repo = "amaranth";
rev = "e5644486fdae47c1372ef2a672b0249857694d66";
hash = "sha256-kg4rTBRSi+1oaxazRWnw7fhTvyQE96a6XjOgk0f2JQ0=";
};
doCheck = false; # uninit'd mem breaks lots of tests.
};
amaranth-boards = prev.amaranth-boards.overridePythonAttrs rec {
version = "0.1.dev250";
src = pkgs.fetchFromGitHub {
owner = "amaranth-lang";
repo = "amaranth-boards";
rev = "19b97324ecf9111c5d16377af79f82aad761c476";
postFetch = "rm -f $out/.git_archival.txt $out/.gitattributes";
hash = "sha256-0uvn91i/yuIY75lL5Oxvozdw7Q2Uw83JWo7srgEYEpI=";
};
build-system = [python.pkgs.pdm-backend];
dontCheckRuntimeDeps = 1; # amaranth 0.6.0.devX doesn't match anything.
};
};
in
pkgs.python3.override {
inherit packageOverrides;
self = python;
};
toolchain-pkgs = with pkgs; [
yosys
icestorm
trellis
nextpnr
openfpgaloader
];
in rec {
formatter = pkgs.alejandra;
packages.default = packages.niar;
packages.python = python;
packages.niar = python.pkgs.buildPythonPackage {
name = "niar";
version = pyproject-toml.project.version;
src = ./.;
pyproject = true;
build-system = [python.pkgs.pdm-backend];
propagatedBuildInputs =
[
python.pkgs.amaranth
python.pkgs.amaranth-boards
]
++ toolchain-pkgs;
doCheck = true;
nativeCheckInputs = [python.pkgs.pytestCheckHook] ++ toolchain-pkgs;
dontCheckRuntimeDeps = 1; # amaranth 0.6.0.devX doesn't match anything.
};
devShells.default = pkgs.mkShell {
name = "niar";
buildInputs = with python.pkgs; [
python-lsp-server
pyls-isort
pylsp-rope
pytest
];
inputsFrom = [packages.default];
};
devShells.pdm = pkgs.mkShell {
name = "niar-pdm";
buildInputs =
[
pkgs.python3
pkgs.pdm
]
++ toolchain-pkgs;
};
});
}