Skip to content

Commit

Permalink
Bump keymap-drawer and build env
Browse files Browse the repository at this point in the history
  • Loading branch information
urob committed Jan 11, 2025
1 parent 332bef0 commit baaa607
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 56 deletions.
4 changes: 2 additions & 2 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ export DIRENV_LOG_FORMAT=$'\033[2mdirenv: %s\033[0m'
# Use flake
use flake

# Watch additional files
watch_file draw/default.nix
# Also rebuild if other local flake inputs change
watch_file nix/*
42 changes: 0 additions & 42 deletions draw/default.nix

This file was deleted.

8 changes: 4 additions & 4 deletions flake.lock

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

19 changes: 11 additions & 8 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

# Version of requirements.txt installed in pythonEnv
zephyr.url = "github:zmkfirmware/zephyr/v3.5.0+zmk-fixes";
Expand All @@ -19,7 +19,7 @@
devShells = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
zephyr = zephyr-nix.packages.${system};
keymap_drawer = pkgs.python3Packages.callPackage ./draw { };
keymap_drawer = pkgs.python3Packages.callPackage ./nix/keymap-drawer.nix { };

in {
default = pkgs.mkShellNoCC {
Expand All @@ -32,21 +32,24 @@
pkgs.cmake
pkgs.dtc
pkgs.ninja
# pkgs.ccache
# pkgs.dfu-util
# pkgs.qemu

# Uncomment these if you don't have system-wide versions:
pkgs.just
pkgs.yq # make sure we use the python version

# -- Uncomment these if you don't have system-wide versions --
# pkgs.gawk # awk
# pkgs.unixtools.column # column
# pkgs.coreutils # cp, cut, echo, mkdir, sort, tail, tee, uniq, wc
# pkgs.diffutils # diff
# pkgs.findutils # find, xargs
# pkgs.gnugrep # grep
pkgs.just # just
# pkgs.gnused # sed
pkgs.yq # yq
];

shellHook = ''
export ZMK_BUILD_DIR=$(pwd)/.build;
export ZMK_SRC_DIR=$(pwd)/zmk/app;
'';
};
});
};
Expand Down
49 changes: 49 additions & 0 deletions nix/keymap-drawer.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{ lib
, buildPythonApplication
, buildPythonPackage
, callPackage
, fetchFromGitHub
, setuptools
, poetry-core
, pydantic
, pcpp
, pyyaml
, platformdirs
, pydantic-settings
, tree-sitter
}:
let
tree-sitter-devicetree = callPackage ./tree-sitter-devicetree.nix {};
in
buildPythonApplication rec {
pname = "keymap-drawer";
version = "0.20.0+revert-poetry";
pyproject = true;

src = fetchFromGitHub {
owner = "caksoylar";
repo = pname;
rev = "a2a3b37c54ddb449428b4597b39c3c28b331a7da";
hash = "sha256-GKGjEHQ/GsLhCzjuglDuztAEIpeaz+fHHmNJJcLmQT8=";
};

build-system = [ poetry-core ];

propagatedBuildInputs = [
pydantic
pcpp
pyyaml
platformdirs
pydantic-settings
tree-sitter
tree-sitter-devicetree
];

doCheck = false;

meta = {
homepage = "https://github.com/caksoylar/keymap-drawer";
description = "Parse QMK & ZMK keymaps and draw them as vector graphics";
license = lib.licenses.mit;
};
}
40 changes: 40 additions & 0 deletions nix/tree-sitter-devicetree.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
tree-sitter,
}:

buildPythonPackage rec {
pname = "tree-sitter-devicetree";
version = "0.12.1";
pyproject = true;

src = fetchFromGitHub {
owner = "joelspadin";
repo = "tree-sitter-devicetree";
rev = "16c9cb959675bc9bc4f4e5bebe473d511a12a06d";
hash = "sha256-UVxLF4IKRXexz+PbSlypS/1QsWXkS/iYVbgmFCgjvZM=";
};

build-system = [
setuptools
];

optional-dependencies = {
core = [
tree-sitter
];
};

# There are no tests
doCheck = false;
pythonImportsCheck = [ "tree_sitter_devicetree" ];

meta = {
description = "Devicetree grammar for tree-sitter";
homepage = "https://github.com/joelspadin/tree-sitter-devicetree";
license = lib.licenses.mit;
};
}

0 comments on commit baaa607

Please sign in to comment.