nitrokey-app2: switch to pypaBuildHook and fix the build

This commit is contained in:
Nicolas Benes 2023-06-21 19:12:00 +02:00
parent 5afa5669c9
commit 48e6a7c70f

View File

@ -8,7 +8,9 @@
python3.pkgs.buildPythonApplication rec { python3.pkgs.buildPythonApplication rec {
pname = "nitrokey-app2"; pname = "nitrokey-app2";
version = "2.1.2"; version = "2.1.2";
format = "flit"; pyproject = true;
disabled = python3.pythonOlder "3.9";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "Nitrokey"; owner = "Nitrokey";
@ -17,11 +19,22 @@ python3.pkgs.buildPythonApplication rec {
hash = "sha256-VyhIFNXxH/FohgjhBeZXoQYppP7PEz+ei0qzsWz1xhk="; hash = "sha256-VyhIFNXxH/FohgjhBeZXoQYppP7PEz+ei0qzsWz1xhk=";
}; };
# https://github.com/Nitrokey/nitrokey-app2/issues/152
#
# pythonRelaxDepsHook does not work here, because it runs in postBuild and
# only modifies the dependencies in the built distribution.
postPatch = ''
substituteInPlace pyproject.toml --replace "pynitrokey ==" "pynitrokey >="
'';
# The pyproject.toml file seems to be incomplete and does not generate
# resources (i.e. run pyrcc5 and pyuic5) but the Makefile does.
preBuild = '' preBuild = ''
make build-ui make build-ui
''; '';
nativeBuildInputs = with python3.pkgs; [ nativeBuildInputs = with python3.pkgs; [
flit-core
pyqt5 pyqt5
wrapQtAppsHook wrapQtAppsHook
]; ];
@ -41,9 +54,14 @@ python3.pkgs.buildPythonApplication rec {
--set-default CRYPTOGRAPHY_OPENSSL_NO_LEGACY 1 --set-default CRYPTOGRAPHY_OPENSSL_NO_LEGACY 1
''; '';
pythonImportsCheck = [
"nitrokeyapp"
];
meta = with lib; { meta = with lib; {
description = "This application allows to manage Nitrokey 3 devices"; description = "This application allows to manage Nitrokey 3 devices";
homepage = "https://github.com/Nitrokey/nitrokey-app2"; homepage = "https://github.com/Nitrokey/nitrokey-app2";
changelog = "https://github.com/Nitrokey/nitrokey-app2/releases/tag/v${version}";
license = licenses.asl20; license = licenses.asl20;
maintainers = with maintainers; [ _999eagle ]; maintainers = with maintainers; [ _999eagle ];
mainProgram = "nitrokeyapp"; mainProgram = "nitrokeyapp";