depends on nixos-23.05-small instead of unstable. improvements from nixos-23.05-small copied, but newer version (0.4.37).

This commit is contained in:
Denis Knauf 2023-05-25 15:21:01 +02:00
commit a5fbe03b27
4 changed files with 119 additions and 0 deletions

27
flake.lock Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1684968804,
"narHash": "sha256-y78lDeiJC/MSOM6HBe1VI5G2lrrmJMkWigRuOrf20uA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f69907854223d6d49f75b1ae52b2f6567f711d90",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.05-small",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

14
flake.nix Normal file
View file

@ -0,0 +1,14 @@
# vim: set noet sw=2 ts=2 sts=2:
{
description = "nitropy cli";
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-23.05-small;
outputs = { self, nixpkgs }: {
defaultPackage.x86_64-linux =
# Notice the reference to nixpkgs here.
with import nixpkgs {
system = "x86_64-linux";
config.allowUnfree = true;
};
callPackage ./pynitrokey.nix { };
};
}

66
pynitrokey.nix Normal file
View file

@ -0,0 +1,66 @@
{ python3Packages, lib, pkgs, nrfutil, libnitrokey }:
with python3Packages;
buildPythonApplication rec {
pname = "pynitrokey";
version = "0.4.37";
format = "flit";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-KoZym1b+E0P3kRt0PTm9wCX4nO31isDIwEq38xMgDDU=";
};
propagatedBuildInputs = [
certifi
cffi
click
cryptography
ecdsa
frozendict
fido2
intelhex
nkdfu
nrfutil
python-dateutil
pyusb
requests
spsdk
tqdm
urllib3
tlv8
typing-extensions
];
nativeBuildInputs = [
pythonRelaxDepsHook
];
pythonRelaxDeps = [
"cryptography"
"protobuf"
"python-dateutil"
"spsdk"
"typing_extensions"
];
# no tests
doCheck = false;
# libnitrokey is not propagated to users of pynitrokey
# It is only usable from the wrapped bin/nitropy
makeWrapperArgs = [
"--set LIBNK_PATH ${lib.makeLibraryPath [ libnitrokey ]}"
];
pythonImportsCheck = [ "pynitrokey" ];
meta = with lib; {
description = "Python client for Nitrokey devices";
homepage = "https://github.com/Nitrokey/pynitrokey";
license = with licenses; [ asl20 mit ];
#maintainers = with maintainers; [ frogamic ];
mainProgram = "nitropy";
};
}

12
shell.nix Normal file
View file

@ -0,0 +1,12 @@
# vim: set noet sw=2 ts=2 sts=2:
{}:
#{ pkgs ? import <nixpkgs> { } }:
let
pkgs = import (fetchTarball https://github.com/NixOS/nixpkgs/archive/nixos-23.05-small.tar.gz) { config.allowUnfree = true; };
pynitrokey = pkgs.callPackage ./pynitrokey.nix { };
in
pkgs.mkShell {
packages = [
pynitrokey
];
}