mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-13 13:15:30 +03:00

Made with ```shell git restore . fd '\.nix$' pkgs/ --type f -j1 -x bash -xc "$(cat <<"EOF" typos --no-check-filenames --write-changes "$1" git diff --exit-code "$1" && exit #( git diff "$1" | grep -qE "^\+ +[^# ]") && git restore "$1" count1="$( bat --language nix --diff --style changes "$1" --theme "Monokai Extended" --color always | aha --no-header | grep -E '^<span style="color:olive;">~</span> ' | wc -l )" count2="$( bat --language nix --diff --style changes "$1" --theme "Monokai Extended" --color always | aha --no-header | grep -E '^<span style="color:olive;">~</span> (<span style="color:#f8f8f2;"> *</span>)?<span style="color:#75715e;">.*</span>$' | wc -l )" [[ $count1 -ne $count2 ]] && git restore "$1" EOF )" -- {} ``` and filtered with `GIT_DIFF_OPTS='--unified=15' git -c interactive.singleKey=true add --patch` I initially tried using the tree-sitter cli, python bindings and even ast-grep through various means, but this is what I ended up with.
65 lines
1.3 KiB
Nix
65 lines
1.3 KiB
Nix
{
|
|
lib,
|
|
buildPythonPackage,
|
|
fetchPypi,
|
|
fetchpatch2,
|
|
|
|
# build-system
|
|
flit-core,
|
|
|
|
# dependencies
|
|
progress,
|
|
pyserial,
|
|
|
|
# optional-dependencies
|
|
intelhex,
|
|
|
|
# tests
|
|
pytestCheckHook,
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "stm32loader";
|
|
version = "0.7.1";
|
|
pyproject = true;
|
|
|
|
src = fetchPypi {
|
|
inherit pname version;
|
|
hash = "sha256-QTLSEjdJtDH4GCamnKHN5pEjW41rRtAMXxyZZMM5K3w=";
|
|
};
|
|
|
|
patches = [
|
|
# fix build with python 3.12
|
|
# https://github.com/florisla/stm32loader/pull/79
|
|
(fetchpatch2 {
|
|
url = "https://github.com/florisla/stm32loader/commit/96f59b2984b0d0371b2da0360d6e8d94d0b39a68.patch?full_index=1";
|
|
hash = "sha256-JUEjQWOnzeMA1OELS214OR7+MYUkCKN5lxwsmRoFbfo=";
|
|
})
|
|
];
|
|
|
|
nativeBuildInputs = [ flit-core ];
|
|
|
|
propagatedBuildInputs = [
|
|
progress
|
|
pyserial
|
|
];
|
|
|
|
optional-dependencies = {
|
|
hex = [ intelhex ];
|
|
};
|
|
|
|
nativeCheckInputs = [
|
|
pytestCheckHook
|
|
] ++ lib.flatten (lib.attrValues optional-dependencies);
|
|
|
|
pytestFlagsArray = [ "tests/unit" ];
|
|
|
|
meta = with lib; {
|
|
description = "Flash firmware to STM32 microcontrollers in Python";
|
|
mainProgram = "stm32loader";
|
|
homepage = "https://github.com/florisla/stm32loader";
|
|
changelog = "https://github.com/florisla/stm32loader/blob/v${version}/CHANGELOG.md";
|
|
license = licenses.gpl3;
|
|
maintainers = [ ];
|
|
};
|
|
}
|