Skip to content

Commit

Permalink
Merge #644: update nixpkgs:
Browse files Browse the repository at this point in the history
c1b370a update nixpkgs (Jonas Nick)

Pull request description:

ACKs for top commit:
  erikarvstedt:
    ACK c1b370a

Tree-SHA512: a8b0c2d9a54286a899950172e62a6c6a84b5d255a0dee5227d6c39d969080a2c42e5999da26a1b00651937f36caf23fce9396eb8d9f6f8dabd368d6d90aa28e6
  • Loading branch information
jonasnick committed Sep 16, 2023
2 parents 19b997f + c1b370a commit eaea0f1
Show file tree
Hide file tree
Showing 15 changed files with 592 additions and 45 deletions.
18 changes: 9 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkgs/pinned.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ pkgs: pkgsUnstable:
elementsd
extra-container
fulcrum
hwi
lndconnect;

inherit (pkgsUnstable)
btcpayserver
clightning
hwi
lightning-loop
lightning-pool
nbxplorer;
Expand Down
23 changes: 0 additions & 23 deletions pkgs/python-packages/coincurve/default.nix

This file was deleted.

21 changes: 20 additions & 1 deletion pkgs/python-packages/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,33 @@ rec {
clightningPkg = pkg: callPackage pkg { inherit (nbPkgs.pinned) clightning; };
in
{
coincurve = callPackage ./coincurve {};
txzmq = callPackage ./txzmq {};

pyln-client = clightningPkg ./pyln-client;
pyln-proto = clightningPkg ./pyln-proto;
pyln-bolt7 = clightningPkg ./pyln-bolt7;
pylightning = clightningPkg ./pylightning;

# cryptography 41, required by pyln-proto
cryptography = callPackage ./specific-versions/cryptography_41 {
Security = super.darwin.apple_sdk.frameworks.Security;
};

# The versions of these packages that ship with nixos-23.05 are incompatible
# with cryptography 41
pyopenssl = callPackage ./specific-versions/pyopenssl_23_2 {};
service-identity = callPackage ./specific-versions/service-identity_23_1 {};

# The twisted package in nixos-23.05 runs a test that fails with
# service-identity 23.1. This package is backported from nixos-unstable
# and disables the test. (see
# https://github.com/twisted/twisted/issues/11877,
# https://github.com/NixOS/nixpkgs/commit/1ee622b10fcafcf2343960e3ffae0169afc59804)
twisted = callPackage ./specific-versions/twisted_22_10 {};

# Used by cryptography 41, backported from nixpkgs-unstable
setuptoolsRustBuildHook = callPackage ./setuptools-rust-hook {};

# bitstring 3.1.9, required by pyln-proto
bitstring = callPackage ./specific-versions/bitstring.nix {};

Expand Down
1 change: 1 addition & 0 deletions pkgs/python-packages/jmbase/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ buildPythonPackage rec {

patchPhase = ''
sed -i 's|twisted==22.4.0|twisted==22.10.0|' setup.py
sed -i 's|service-identity==21.1.0|service-identity==23.1.0|' setup.py
'';

propagatedBuildInputs = [ future twisted service-identity chromalog txtorcon ];
Expand Down
6 changes: 2 additions & 4 deletions pkgs/python-packages/pyln-proto/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
, cryptography
, coincurve
, base58
, pysocks
}:

buildPythonPackage rec {
Expand All @@ -22,13 +23,10 @@ buildPythonPackage rec {
cryptography
coincurve
base58
pysocks
];

checkInputs = [ pytestCheckHook ];

postUnpack = "sourceRoot=$sourceRoot/contrib/pyln-proto";

postPatch = ''
sed -i 's|cryptography = "^36.0.1"|cryptography = "^40.0"|' pyproject.toml
'';
}
13 changes: 13 additions & 0 deletions pkgs/python-packages/setuptools-rust-hook/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{ lib, stdenv, python, makePythonHook, setuptools-rust, rust }:
makePythonHook {
name = "setuptools-rust-setup-hook";
propagatedBuildInputs = [ setuptools-rust ];
substitutions = {
pyLibDir = "${python}/lib/${python.libPrefix}";
cargoBuildTarget = rust.toRustTargetSpec stdenv.hostPlatform;
cargoLinkerVar = lib.toUpper (
builtins.replaceStrings ["-"] ["_"] (
rust.toRustTarget stdenv.hostPlatform));
targetLinker = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
};
} ./setuptools-rust-hook.sh
18 changes: 18 additions & 0 deletions pkgs/python-packages/setuptools-rust-hook/setuptools-rust-hook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
echo "Sourcing setuptools-rust-hook"

setuptoolsRustSetup() {
# This can work only if rustPlatform.cargoSetupHook is also included
if ! command -v cargoSetupPostPatchHook >/dev/null; then
echo "ERROR: setuptools-rust has to be used alongside with rustPlatform.cargoSetupHook!"
exit 1
fi

export PYO3_CROSS_LIB_DIR="@pyLibDir@"
export CARGO_BUILD_TARGET=@cargoBuildTarget@
# TODO theoretically setting linker should not be required because it is
# already set in pkgs/build-support/rust/hooks/default.nix but build fails
# on missing linker without this.
export CARGO_TARGET_@cargoLinkerVar@_LINKER=@targetLinker@
}

preConfigureHooks+=(setuptoolsRustSetup)
116 changes: 116 additions & 0 deletions pkgs/python-packages/specific-versions/cryptography_41/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{ lib
, stdenv
, buildPythonPackage
, callPackage
, cargo
, cffi
, fetchPypi
, hypothesis
, iso8601
, isPyPy
, libiconv
, libxcrypt
, openssl
, pkg-config
, pretend
, py
, pytest-subtests
, pytestCheckHook
, pythonOlder
, pytz
, rustc
, rustPlatform
, Security
, setuptoolsRustBuildHook
}:

let
cryptography-vectors = callPackage ./vectors.nix { };
in
buildPythonPackage rec {
pname = "cryptography";
version = "41.0.3"; # Also update the hash in vectors.nix
format = "pyproject";
disabled = pythonOlder "3.7";

src = fetchPypi {
inherit pname version;
hash = "sha256-bRknQRE+9eMNidy1uVbvThV48wRwhwG4tz044+FGHzQ=";
};

cargoDeps = rustPlatform.fetchCargoTarball {
inherit src;
sourceRoot = "${pname}-${version}/${cargoRoot}";
name = "${pname}-${version}";
hash = "sha256-LQu7waympGUs+CZun2yDQd2gUUAgyisKBG5mddrfSo0=";
};

postPatch = ''
substituteInPlace pyproject.toml \
--replace "--benchmark-disable" ""
'';

cargoRoot = "src/rust";

nativeBuildInputs = [
rustPlatform.cargoSetupHook
setuptoolsRustBuildHook
cargo
rustc
pkg-config
] ++ lib.optionals (!isPyPy) [
cffi
];

buildInputs = [
openssl
] ++ lib.optionals stdenv.isDarwin [
Security
libiconv
] ++ lib.optionals (pythonOlder "3.9") [
libxcrypt
];

propagatedBuildInputs = lib.optionals (!isPyPy) [
cffi
];

nativeCheckInputs = [
cryptography-vectors
# Work around `error: infinite recursion encountered`
(hypothesis.override { enableDocumentation = false; })
iso8601
pretend
py
pytestCheckHook
pytest-subtests
pytz
];

pytestFlagsArray = [
"--disable-pytest-warnings"
];

disabledTestPaths = [
# save compute time by not running benchmarks
"tests/bench"
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
# aarch64-darwin forbids W+X memory, but this tests depends on it:
# * https://cffi.readthedocs.io/en/latest/using.html#callbacks
"tests/hazmat/backends/test_openssl_memleak.py"
];

meta = with lib; {
description = "A package which provides cryptographic recipes and primitives";
longDescription = ''
Cryptography includes both high level recipes and low level interfaces to
common cryptographic algorithms such as symmetric ciphers, message
digests, and key derivation functions.
'';
homepage = "https://github.com/pyca/cryptography";
changelog = "https://cryptography.io/en/latest/changelog/#v"
+ replaceStrings [ "." ] [ "-" ] version;
license = with licenses; [ asl20 bsd3 psfl ];
maintainers = with maintainers; [ SuperSandro2000 ];
};
}
38 changes: 38 additions & 0 deletions pkgs/python-packages/specific-versions/cryptography_41/vectors.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{ lib
, buildPythonPackage
, fetchPypi
, cryptography
, setuptools
}:

buildPythonPackage rec {
pname = "cryptography-vectors";
# The test vectors must have the same version as the cryptography package
inherit (cryptography) version;
format = "pyproject";

src = fetchPypi {
pname = "cryptography_vectors";
inherit version;
hash = "sha256-gN4EUsSzT1b1UY6B69dba5BfVyiq7VIdQuQfTryKQ/s=";
};

nativeBuildInputs = [
setuptools
];

# No tests included
doCheck = false;

pythonImportsCheck = [
"cryptography_vectors"
];

meta = with lib; {
description = "Test vectors for the cryptography package";
homepage = "https://cryptography.io/en/latest/development/test-vectors/";
downloadPage = "https://github.com/pyca/cryptography/tree/master/vectors";
license = with licenses; [ asl20 bsd3 ];
maintainers = with maintainers; [ SuperSandro2000 ];
};
}
Loading

0 comments on commit eaea0f1

Please sign in to comment.