Add keymap drawer binary

This commit is contained in:
urob 2024-08-13 14:56:03 -04:00
parent 8494b9cf92
commit c6fbdc3c5f
4 changed files with 68 additions and 5 deletions

1
.envrc
View file

@ -3,3 +3,4 @@ export DIRENV_LOG_FORMAT=$'\033[2mdirenv: %s\033[0m'
# Use flake # Use flake
use flake use flake
watch_file keymap_drawer.nix

20
flake.lock generated
View file

@ -50,6 +50,22 @@
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": {
"lastModified": 1723400035,
"narHash": "sha256-WoKZDlBEdMhP+hjquBAh0BhUJbcH2+U8g2mHOr1mv8I=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a731b45590a5169542990c36ffcde6cebd9a3356",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1720535198, "lastModified": 1720535198,
"narHash": "sha256-zwVvxrdIzralnSbcpghA92tWu2DV2lwv89xZc8MTrbg=", "narHash": "sha256-zwVvxrdIzralnSbcpghA92tWu2DV2lwv89xZc8MTrbg=",
@ -114,9 +130,7 @@
}, },
"zephyr-nix": { "zephyr-nix": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": "nixpkgs_2",
"nixpkgs"
],
"pyproject-nix": "pyproject-nix", "pyproject-nix": "pyproject-nix",
"zephyr": [ "zephyr": [
"zephyr" "zephyr"

View file

@ -1,7 +1,7 @@
{ {
inputs = { inputs = {
# Pin this to 23.11 to provide py3.8 needed for the sdk-ng without building it ourselves # Pin this to 23.11 to provide py3.8 needed for the sdk-ng without building it ourselves
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
# Zephyr version determining which requirements.txt to use to install python dependencies # Zephyr version determining which requirements.txt to use to install python dependencies
zephyr.url = "github:zephyrproject-rtos/zephyr/v3.5.0"; zephyr.url = "github:zephyrproject-rtos/zephyr/v3.5.0";
@ -9,7 +9,7 @@
# Zephyr sdk and host tools # Zephyr sdk and host tools
zephyr-nix.url = "github:urob/zephyr-nix"; zephyr-nix.url = "github:urob/zephyr-nix";
zephyr-nix.inputs.nixpkgs.follows = "nixpkgs"; # zephyr-nix.inputs.nixpkgs.follows = "nixpkgs";
zephyr-nix.inputs.zephyr.follows = "zephyr"; zephyr-nix.inputs.zephyr.follows = "zephyr";
}; };
@ -19,10 +19,12 @@
devShells = forAllSystems (system: let devShells = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
zephyr = zephyr-nix.packages.${system}; zephyr = zephyr-nix.packages.${system};
keymap_drawer = pkgs.python3Packages.callPackage ./keymap_drawer.nix { };
in { in {
default = pkgs.mkShell { default = pkgs.mkShell {
packages = [ packages = [
keymap_drawer
zephyr.hosttools-nix zephyr.hosttools-nix
zephyr.pythonEnv zephyr.pythonEnv
(zephyr.sdk.override { targets = [ "arm-zephyr-eabi" ]; }) (zephyr.sdk.override { targets = [ "arm-zephyr-eabi" ]; })

46
keymap_drawer.nix Normal file
View file

@ -0,0 +1,46 @@
{
lib,
buildPythonApplication,
fetchPypi,
poetry-core,
pydantic,
pcpp,
pyparsing,
pyyaml,
platformdirs,
pydantic-settings,
}:
buildPythonApplication rec {
pname = "keymap-drawer";
version = "0.18.0";
pyproject = true;
src = fetchPypi {
pname = "keymap_drawer";
inherit version;
hash = "sha256-faJB+cjj740Ny2wqVwc5t/+grEWBIEyhex3RoLCuIs8=";
};
postPatch = ''
substituteInPlace pyproject.toml --replace 'platformdirs = "^3.5.1"' 'platformdirs = "^4.0.0"'
'';
build-system = [poetry-core];
propagatedBuildInputs = [
pydantic
pcpp
pyparsing
pyyaml
platformdirs
pydantic-settings
];
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;
};
}