nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 86 lines 2.0 kB view raw
1{ 2 lib, 3 4 buildPythonPackage, 5 callPackages, 6 fetchFromGitHub, 7 pythonOlder, 8 9 keymap-drawer, 10 nix-update-script, 11 pcpp, 12 platformdirs, 13 poetry-core, 14 pydantic, 15 pydantic-settings, 16 pyparsing, 17 pyyaml, 18 tree-sitter, 19 tree-sitter-grammars, 20 versionCheckHook, 21}: 22let 23 version = "0.22.1"; 24in 25buildPythonPackage { 26 inherit version; 27 pname = "keymap-drawer"; 28 pyproject = true; 29 disabled = pythonOlder "3.12"; 30 31 src = fetchFromGitHub { 32 owner = "caksoylar"; 33 repo = "keymap-drawer"; 34 tag = "v${version}"; 35 hash = "sha256-X3O5yspEdey03YQ6JsYN/DE9NUiq148u1W6LQpUQ3ns="; 36 }; 37 38 build-system = [ poetry-core ]; 39 40 pythonRelaxDeps = [ 41 "tree-sitter-devicetree" 42 ]; 43 44 dependencies = [ 45 pcpp 46 platformdirs 47 pydantic 48 pydantic-settings 49 pyparsing 50 pyyaml 51 tree-sitter 52 tree-sitter-grammars.tree-sitter-devicetree 53 ]; 54 55 nativeCheckInputs = [ 56 versionCheckHook 57 ]; 58 59 pythonImportsCheck = [ "keymap_drawer" ]; 60 61 versionCheckProgram = "${placeholder "out"}/bin/keymap"; 62 63 passthru.tests = callPackages ./tests { 64 # Explicitly pass the correctly scoped package. 65 # The top-level package will still resolve to itself, because the way 66 # `toPythonApplication` interacts with scopes is weird. 67 inherit keymap-drawer; 68 }; 69 passthru.updateScript = nix-update-script { }; 70 71 meta = { 72 description = "Module and CLI tool to help parse and draw keyboard layouts"; 73 homepage = "https://github.com/caksoylar/keymap-drawer"; 74 changelog = "https://github.com/caksoylar/keymap-drawer/releases/tag/v${version}"; 75 license = lib.licenses.mit; 76 maintainers = with lib.maintainers; [ 77 MattSturgeon 78 ]; 79 mainProgram = "keymap"; 80 # keymap-drawer currently requires tree-sitter 0.24.0 81 # See https://github.com/caksoylar/keymap-drawer/issues/183 82 # top-level package `keymap-drawer` is not broken due to this 83 # incompatibility, thanks to a Python override 84 broken = lib.versionAtLeast tree-sitter.version "0.25.0"; 85 }; 86}