Skip to content

Commit 5905e4c

Browse files
committed
build(nix): add nix flake so NixOS users can use the CLI
1 parent f2f7a30 commit 5905e4c

File tree

3 files changed

+133
-0
lines changed

3 files changed

+133
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,6 @@ cython_debug/
162162

163163
# VS Code settings
164164
.vscode/launch.json
165+
166+
# nix related
167+
result*

flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
description = "The CLI tool for ZMK";
3+
4+
inputs = {
5+
flake-parts.url = "github:hercules-ci/flake-parts";
6+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
7+
};
8+
9+
outputs =
10+
inputs@{ flake-parts, ... }:
11+
flake-parts.lib.mkFlake { inherit inputs; } {
12+
systems = [
13+
"x86_64-linux"
14+
"aarch64-linux"
15+
"aarch64-darwin"
16+
"x86_64-darwin"
17+
];
18+
perSystem =
19+
{
20+
self',
21+
pkgs,
22+
...
23+
}:
24+
let
25+
python = pkgs.python3Packages;
26+
in
27+
{
28+
packages.default = self'.packages.zmk-cli;
29+
packages.zmk-cli = python.buildPythonPackage (finalAttrs: {
30+
pname = "zmk";
31+
version = "0.4.0";
32+
src = ./.;
33+
34+
pyproject = true;
35+
36+
# basically required for all python packages
37+
build-system = [
38+
python.setuptools
39+
python.setuptools-scm
40+
];
41+
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;
53+
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+
});
67+
};
68+
};
69+
}

0 commit comments

Comments
 (0)