Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,6 @@ cython_debug/

# VS Code settings
.vscode/launch.json

# nix related
result*
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

84 changes: 84 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
description = "The CLI tool for ZMK";

inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};

outputs =
inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
perSystem =
{
self',
lib,
pkgs,
...
}:
let
python = pkgs.python3Packages;
in
{
packages.default = self'.packages.zmk-cli;
packages.zmk-cli =
let
pyprojectToml = lib.importTOML ./pyproject.toml;
in
python.buildPythonPackage (finalAttrs: {
pname = pyprojectToml.project.name;
version = pyprojectToml.project.version;
src = ./.;

pyproject = true;

# basically required for all python packages
build-system = [
python.setuptools
python.setuptools-scm
];

# This is required since some deps in the nixpkgs python
# distribution are slightly too old. But this should be resolved
# fairly soon
#
# At the time of writing this we have
#
# > Checking runtime dependencies for zmk-0.4.0-py3-none-any.whl
# > - dacite<2.0.0,>=1.9.2 not satisfied by version 1.9.1
# > - mako<2.0.0,>=1.3.10 not satisfied by version 1.3.10.dev0
# > - ruamel-yaml<0.19.0,>=0.18.17 not satisfied by version 0.18.16
pythonRelaxDeps = true;

# those were infered by just building the package, the check phase
# will inform you about missing deps if any new ones should pop up
dependencies = [
python.dacite
python.giturlparse
python.mako
python.rich
python.ruamel-yaml
python.shellingham
python.typer
python.west
];
});
devShells.default = self'.devShells.zmk-cli;
devShells.zmk-cli = pkgs.mkShell {
name = "zmk-cli dev shell";
packages = [
self'.packages.zmk-cli
# `zmk-cli` starts `west` processes so we need it to be available
# in the shell environment
python.west
];
};
};
};
}
31 changes: 14 additions & 17 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
[project]
name = "zmk"
description = "A command line program to help set up ZMK Firmware"
readme = "README.md"
requires-python = ">=3.11"
license-files = ["LICENSE"]
classifiers = [
"Development Status :: 3 - Alpha",
"Environment :: Console",
Expand All @@ -24,31 +19,33 @@ dependencies = [
"typer >= 0.21.0, < 0.22.0",
"west >= 1.5.0, < 2.0.0",
]
dynamic = ["version"]
description = "A command line program to help set up ZMK Firmware"
license-files = ["LICENSE"]
name = "zmk"
readme = "README.md"
requires-python = ">=3.11"
version = "0.4.0"
# dynamic = ["version"]

[project.urls]
Chat = "https://zmk.dev/community/discord/invite"
Documentation = "https://zmk.dev/docs"
Chat = "https://zmk.dev/community/discord/invite"
Documentation = "https://zmk.dev/docs"
"Issue Tracker" = "https://github.com/zmkfirmware/zmk-cli/issues/"
"Source Code" = "https://github.com/zmkfirmware/zmk-cli/"
"Source Code" = "https://github.com/zmkfirmware/zmk-cli/"

[project.scripts]
zmk = "zmk.main:app"

[dependency-groups]
dev = [
"prek>=0.3.3",
"pyright>=1.1.408",
"ruff>=0.15.2",
]
dev = ["prek>=0.3.3", "pyright>=1.1.408", "ruff>=0.15.2"]

[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"
requires = ["setuptools", "setuptools-scm"]

[tool.pyright]
venv = ".venv"
venvPath = "."
venv = ".venv"

[tool.ruff.lint]
select = [
Expand Down Expand Up @@ -99,7 +96,7 @@ select = [
# flake8-type-checking
"TC",
# pyupgrade
"UP"
"UP",
]

[tool.setuptools]
Expand Down