Created
December 31, 2024 16:45
-
-
Save qbit/f4ea6735fb18bb23f3fc9ad2fe95df7a to your computer and use it in GitHub Desktop.
Start of packaging pqconnect for NixOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ buildPythonPackage | |
, click | |
, cython | |
, dnspython | |
, fetchFromGitHub | |
, fetchFromGitLab | |
, flit | |
, libnetfilter_queue | |
, libnfnetlink | |
, libsodium | |
, lib25519 | |
, openssl | |
, pkg-config | |
, pyroute2 | |
, scapy | |
, setuptools | |
, setuptools-scm | |
, ... | |
}: | |
let | |
pymceliece = buildPythonPackage rec { | |
pname = "pymceliece"; | |
version = "0.0.3"; | |
pyproject = true; | |
build-system = [ | |
flit | |
]; | |
src = fetchFromGitHub { | |
owner = "ondesmartenot"; | |
repo = pname; | |
tag = "v${version}"; | |
hash = "sha256-kvHXHFuzPL1RM/1lvOSNnFgR+DS+yAGzuMKbqjmu7mk="; | |
}; | |
}; | |
pyntruprime = buildPythonPackage rec { | |
pname = "pyntruprime"; | |
version = "0.0.3"; | |
pyproject = true; | |
build-system = [ | |
flit | |
]; | |
src = fetchFromGitHub { | |
owner = "ondesmartenot"; | |
repo = pname; | |
tag = "v${version}"; | |
hash = "sha256-cXDGwYH/GJbItXFomMz9r7pp7BfmlEZPJd5mVa/HhnE="; | |
}; | |
}; | |
netfilterqueue = buildPythonPackage rec { | |
pname = "netfilterqueue"; | |
version = "1.1.0"; | |
buildInputs = [ | |
cython | |
libnfnetlink | |
libnetfilter_queue | |
pkg-config | |
]; | |
src = fetchFromGitHub { | |
repo = "python-netfilterqueue"; | |
owner = "oremanj"; | |
tag = "v${version}"; | |
hash = "sha256-2/EF+WGy5SjunaMonQmN2TQ8G5awh1Cvn90LRx7QS9k="; | |
}; | |
}; | |
SecureString = buildPythonPackage rec { | |
pname = "securestring"; | |
version = "0.2"; | |
buildInputs = [ | |
openssl | |
]; | |
src = fetchFromGitHub { | |
repo = "pysecstr"; | |
owner = "dnet"; | |
tag = "v${version}"; | |
hash = "sha256-FV5NUPberA5nqHad8IwkQLMldT1DPqTGpqOwgQ2zSdI="; | |
}; | |
}; | |
py25519 = buildPythonPackage rec { | |
pname = "py25519"; | |
version = "20241202"; | |
pyproject = true; | |
buildInputs = [ | |
pkg-config | |
lib25519 | |
]; | |
build-system = [ | |
flit | |
]; | |
propagatedBuildInputs = [ | |
lib25519 | |
]; | |
# TODO: ?!? | |
# When this check is enabled it fails to find lib25519, not sure if I have used the wrong buildInputs.. | |
# or what. | |
# > Traceback (most recent call last): | |
# > File "/build/source/test/test_dh.py", line 3, in <module> | |
# > from py25519 import ( | |
# > File "/nix/store/bxsx40jlx6xz6cw8wgwvl8zd9ack14gv-python3.12-py25519-20241202/lib/python3.12/site-packages/py25519/__init__.py", line 13, in <module> | |
# > lib = CDLL(util.find_library("25519")) | |
# > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
# > File "/nix/store/c9m6yd8fg1flz2j5r4bif1ib5j20a0cy-python3-3.12.8/lib/python3.12/ctypes/__init__.py", line 379, in __init__ | |
# > self._handle = _dlopen(self._name, mode) | |
# > ^^^^^^^^^^^^^^^^^^^^^^^^^ | |
# > OSError: lib25519.so.1: cannot open shared object file: No such file or directory | |
checkPhase = '' | |
python test/test_dh.py | |
''; | |
src = fetchFromGitHub { | |
owner = "ondesmartenot"; | |
repo = "py25519"; | |
rev = version; | |
hash = "sha256-yaUG7VLTPRNX0LPKevsDTH9Ms0t0PqwCLUBEvVGHJqA="; | |
}; | |
}; | |
nftables' = buildPythonPackage rec { | |
pname = "pynftables"; | |
version = "1.0.5-1"; | |
build-system = [ setuptools setuptools-scm ]; | |
sourceRoot = "${src.name}/py"; | |
src = fetchFromGitLab { | |
domain = "salsa.debian.org"; | |
owner = "pkg-netfilter-team"; | |
repo = "pkg-nftables"; | |
rev = "debian/1.0.5-1"; | |
hash = "sha256-C3c4lQtCNsWd3066b/4B8x88wGFWWjURmjM09I6ZexQ="; | |
}; | |
}; | |
pysodium = buildPythonPackage rec { | |
pname = "pysodium"; | |
version = "0.7.18"; | |
buildInputs = [ | |
libsodium | |
]; | |
src = fetchFromGitHub { | |
owner = "stef"; | |
repo = "pysodium"; | |
tag = "v${version}"; | |
hash = "sha256-F2215AAI8UIvn6UbaJ/YxI4ZolCzlwY6nS5IafTs+i4="; | |
}; | |
}; | |
in | |
buildPythonPackage rec { | |
pname = "pqconnect"; | |
version = "1.2.1"; | |
pyproject = true; | |
propagatedBuildInputs = [ | |
py25519 | |
nftables' | |
click | |
dnspython | |
pyroute2 | |
pysodium | |
pymceliece | |
pyntruprime | |
netfilterqueue | |
scapy | |
SecureString | |
]; | |
buildInputs = [ | |
flit | |
]; | |
src = fetchTarball { | |
url = "https://www.pqconnect.net/pqconnect-${version}.tar.gz"; | |
sha256 = "sha256:0r8wqphb88asz3r2b1iwpi3r1k6g0wsqxwlxsd03s4vm96v3knjg"; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment