packages/cynthion: init

This commit is contained in:
Artemis Tosini 2024-07-10 01:46:37 +00:00
parent dfa45e4f86
commit 2a1528fdab
Signed by: artemist
GPG key ID: ADFFE553DCBB831E
2 changed files with 216 additions and 0 deletions

View file

@ -58,6 +58,7 @@
attic = final.callPackage ./packages/attic { }; attic = final.callPackage ./packages/attic { };
attic-client = final.attic.override { clientOnly = true; }; attic-client = final.attic.override { clientOnly = true; };
cups-dymo-patched = final.callPackage ./packages/cups-dymo { }; cups-dymo-patched = final.callPackage ./packages/cups-dymo { };
cynthion = final.callPackage ./packages/cynthion { };
hactoolnet = final.callPackage ./packages/hactoolnet { }; hactoolnet = final.callPackage ./packages/hactoolnet { };
ipsw = final.callPackage ./packages/ipsw { }; ipsw = final.callPackage ./packages/ipsw { };
jlink = final.callPackage ./packages/jlink { }; jlink = final.callPackage ./packages/jlink { };

View file

@ -0,0 +1,215 @@
{ fetchFromGitHub, python3 }:
let
pyfwup = python3.pkgs.buildPythonPackage rec {
pname = "pyfwup";
version = "0.4.0";
src = fetchFromGitHub {
owner = "greatscottgadgets";
repo = pname;
rev = version;
hash = "sha256-JSaAEGobdLqpSj9yvKrAsXfdkHpXSCcuGYRxz2QJqck=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail '"setuptools-git-versioning<2"' "" \
--replace-fail 'dynamic = ["version"]' 'version = "${version}"'
'';
pyproject = true;
nativeBuildInputs = with python3.pkgs; [ setuptools ];
propagatedBuildInputs = with python3.pkgs; [
pyusb
tqdm
];
};
pygreat = python3.pkgs.buildPythonPackage rec {
pname = "pygreat";
version = "2024.0.1";
src = fetchFromGitHub {
owner = "greatscottgadgets";
repo = "libgreat";
rev = "v${version}";
hash = "sha256-k+0dGBohKglQEFN13mGsw0C6pCeQDRp+CwPW2GuKfuY=";
};
sourceRoot = "${src.name}/host";
postPatch = ''
substituteInPlace pyproject.toml --replace '"backports.functools_lru_cache",' ""
substituteInPlace pygreat/comms.py --replace "from backports.functools_lru_cache import lru_cache as memoize_with_lru_cache" "from functools import lru_cache as memoize_with_lru_cache"
substituteInPlace pyproject.toml \
--replace-fail '"setuptools-git-versioning<2"' "" \
--replace-fail 'dynamic = ["version"]' 'version = "${version}"'
'';
pyproject = true;
nativeBuildInputs = with python3.pkgs; [ setuptools ];
propagatedBuildInputs = with python3.pkgs; [
pyusb
future
];
};
amaranth = python3.pkgs.amaranth.overrideAttrs (attrs: rec {
version = "0.4.1";
src = fetchFromGitHub {
owner = "amaranth-lang";
repo = "amaranth";
rev = "refs/tags/v${version}";
hash = "sha256-VMgycvxkphdpWIib7aZwh588En145RgYlG2Zfi6nnDo=";
};
});
apollo-fpga = python3.pkgs.buildPythonPackage rec {
pname = "apollo";
version = "1.0.7";
src = fetchFromGitHub {
owner = "greatscottgadgets";
repo = pname;
rev = "v${version}";
hash = "sha256-+a6C1JiSxnIZTjnmkEHKZyjFyDQ0HhGQjBGpxkFIgkY=";
};
pyproject = true;
nativeBuildInputs = with python3.pkgs; [ setuptools ];
propagatedBuildInputs = with python3.pkgs; [
importlib-resources
pyusb
pyvcd
prompt-toolkit
pyxdg
];
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail '"setuptools-git-versioning<2"' "" \
--replace-fail 'dynamic = ["version"]' 'version = "${version}"'
'';
};
usb-protocol = python3.pkgs.buildPythonPackage rec {
pname = "usb-protocol";
version = "0.9.1";
src = fetchFromGitHub {
owner = "greatscottgadgets";
repo = "python-usb-protocol";
rev = version;
hash = "sha256-CYbXs/SRC1FAVEzfw0gwf6U0qQ9Q34nyuj5yfjHfDn8=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail '"setuptools-git-versioning<2"' "" \
--replace-fail 'dynamic = ["version"]' 'version = "${version}"'
'';
pyproject = true;
nativeBuildInputs = with python3.pkgs; [ setuptools ];
propagatedBuildInputs = with python3.pkgs; [ construct ];
};
luna-usb = python3.pkgs.buildPythonPackage rec {
pname = "luna-usb";
version = "0.1.1";
src = fetchFromGitHub {
owner = "greatscottgadgets";
repo = "luna";
rev = version;
hash = "sha256-81GJF3QLERCmvZXYlQvb1vzJFeGMSMNMwuGoaBJE8Zg=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail '"setuptools-git-versioning<2"' "" \
--replace-fail 'dynamic = ["version"]' 'version = "${version}"'
'';
pyproject = true;
nativeBuildInputs = with python3.pkgs; [ setuptools ];
propagatedBuildInputs =
[
amaranth
usb-protocol
]
++ (with python3.pkgs; [
libusb1
pyserial
pyusb
pyvcd
]);
};
luna-soc = python3.pkgs.buildPythonPackage rec {
pname = "luna-soc";
version = "0.2.0";
src = fetchFromGitHub {
owner = "greatscottgadgets";
repo = pname;
rev = version;
hash = "sha256-P8P32hM1cVXENcDpCrmPe8BvkMCWdeEgHwbIU94uLe8=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail '"setuptools-git-versioning<2"' "" \
--replace-fail 'dynamic = ["version"]' 'version = "${version}"'
'';
pyproject = true;
nativeBuildInputs = with python3.pkgs; [ setuptools ];
propagatedBuildInputs = [ luna-usb ];
};
version = "0.1.2";
src = fetchFromGitHub {
owner = "greatscottgadgets";
repo = "cynthion";
rev = version;
hash = "sha256-eLimS2gghT52tV01ZlFs8xEwwibB4yezl3eW7zrHpW8=";
};
in
python3.pkgs.buildPythonApplication {
pname = "cynthion";
inherit version src;
sourceRoot = "${src.name}/cynthion/python";
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail '"setuptools-git-versioning<2"' "" \
--replace-fail 'dynamic = ["version"]' 'version = "${version}"'
'';
postInstall = ''
install -D assets/54-cynthion.rules $out/lib/udev/rules.d/54-cynthion.rules
'';
pyproject = true;
nativeBuildInputs = with python3.pkgs; [ setuptools ];
propagatedBuildInputs =
[
amaranth
apollo-fpga
pyfwup
pygreat
luna-usb
luna-soc
]
++ (with python3.pkgs; [
future
libusb1
prompt-toolkit
pyserial
pyusb
tabulate
tomli
tqdm
]);
}