Skip to content

Commit 0974cb1

Browse files
committed
feat(nix): source build information from pyproject.toml
1 parent 72dfd7d commit 0974cb1

File tree

2 files changed

+41
-35
lines changed

2 files changed

+41
-35
lines changed

flake.nix

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
perSystem =
1919
{
2020
self',
21+
lib,
2122
pkgs,
2223
...
2324
}:
@@ -26,44 +27,48 @@
2627
in
2728
{
2829
packages.default = self'.packages.zmk-cli;
29-
packages.zmk-cli = python.buildPythonPackage (finalAttrs: {
30-
pname = "zmk";
31-
version = "0.4.0";
32-
src = ./.;
30+
packages.zmk-cli =
31+
let
32+
pyprojectToml = lib.importTOML ./pyproject.toml;
33+
in
34+
python.buildPythonPackage (finalAttrs: {
35+
pname = pyprojectToml.project.name;
36+
version = pyprojectToml.project.version;
37+
src = ./.;
3338

34-
pyproject = true;
39+
pyproject = true;
3540

36-
# basically required for all python packages
37-
build-system = [
38-
python.setuptools
39-
python.setuptools-scm
40-
];
41+
# basically required for all python packages
42+
build-system = [
43+
python.setuptools
44+
python.setuptools-scm
45+
];
4146

42-
# This is required since some deps in the nixpkgs python
43-
# distribution are slightly too old. But this should be resolved
44-
# fairly soon
45-
#
46-
# At the time of writing this we have
47-
#
48-
# > Checking runtime dependencies for zmk-0.4.0-py3-none-any.whl
49-
# > - dacite<2.0.0,>=1.9.2 not satisfied by version 1.9.1
50-
# > - mako<2.0.0,>=1.3.10 not satisfied by version 1.3.10.dev0
51-
# > - ruamel-yaml<0.19.0,>=0.18.17 not satisfied by version 0.18.16
52-
pythonRelaxDeps = true;
47+
# This is required since some deps in the nixpkgs python
48+
# distribution are slightly too old. But this should be resolved
49+
# fairly soon
50+
#
51+
# At the time of writing this we have
52+
#
53+
# > Checking runtime dependencies for zmk-0.4.0-py3-none-any.whl
54+
# > - dacite<2.0.0,>=1.9.2 not satisfied by version 1.9.1
55+
# > - mako<2.0.0,>=1.3.10 not satisfied by version 1.3.10.dev0
56+
# > - ruamel-yaml<0.19.0,>=0.18.17 not satisfied by version 0.18.16
57+
pythonRelaxDeps = true;
5358

54-
# those were infered by just building the package, the check phase
55-
# will inform you about missing deps if any new ones should pop up
56-
dependencies = [
57-
python.dacite
58-
python.giturlparse
59-
python.mako
60-
python.rich
61-
python.ruamel-yaml
62-
python.shellingham
63-
python.typer
64-
python.west
65-
];
66-
});
59+
# those were infered by just building the package, the check phase
60+
# will inform you about missing deps if any new ones should pop up
61+
dependencies = [
62+
python.dacite
63+
python.giturlparse
64+
python.mako
65+
python.rich
66+
python.ruamel-yaml
67+
python.shellingham
68+
python.typer
69+
python.west
70+
];
71+
});
6772
};
6873
};
6974
}

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ dependencies = [
2020
"west >= 1.5.0, < 2.0.0",
2121
]
2222
description = "A command line program to help set up ZMK Firmware"
23-
dynamic = ["version"]
2423
license-files = ["LICENSE"]
2524
name = "zmk"
2625
readme = "README.md"
2726
requires-python = ">=3.11"
27+
version = "0.4.0"
28+
# dynamic = ["version"]
2829

2930
[project.urls]
3031
Chat = "https://zmk.dev/community/discord/invite"

0 commit comments

Comments
 (0)