From 391a5fdc5b50f83b749d34e15964a068a4dc1f2f Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Wed, 22 Jul 2020 12:03:59 +0200 Subject: [PATCH 1/4] python-packages: fix trailing whitespaces --- pkgs/top-level/python-packages.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index ebf2585bfffe..661966cb7681 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1043,7 +1043,7 @@ in { nvchecker = callPackage ../development/python-modules/nvchecker { }; numericalunits = callPackage ../development/python-modules/numericalunits { }; - + nunavut = callPackage ../development/python-modules/nunavut { }; oath = callPackage ../development/python-modules/oath { }; @@ -1677,7 +1677,7 @@ in { inherit (pkgs.darwin.apple_sdk.frameworks) ApplicationServices CoreServices; }; - pyuavcan = callPackage ../development/python-modules/pyuavcan { + pyuavcan = callPackage ../development/python-modules/pyuavcan { # this version pinpoint to anold version is necessary due to a regression nunavut = self.nunavut.overridePythonAttrs ( old: rec { version = "0.2.3"; @@ -4491,7 +4491,7 @@ in { })); libkeepass = callPackage ../development/python-modules/libkeepass { }; - + libredwg = toPythonModule (pkgs.libredwg.override { enablePython = true; inherit (self) python libxml2; @@ -4544,7 +4544,7 @@ in { locustio = callPackage ../development/python-modules/locustio { }; - llvmlite = callPackage ../development/python-modules/llvmlite { + llvmlite = callPackage ../development/python-modules/llvmlite { llvm = pkgs.llvm_9; # llvmlite always requires a specific version of llvm. }; @@ -6702,7 +6702,7 @@ in { zipp = if pythonOlder "3.6" then callPackage ../development/python-modules/zipp/1.nix { } - else + else callPackage ../development/python-modules/zipp { }; zope_broken = callPackage ../development/python-modules/zope_broken { }; From 8ad62167e82cc6fb43c044a157da1387fa29eea2 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Fri, 10 Jul 2020 00:05:48 +0200 Subject: [PATCH 2/4] certbot: move to python package set, cleanup --- .../python-modules}/certbot/default.nix | 28 +++++++++---------- pkgs/top-level/all-packages.nix | 2 +- pkgs/top-level/python-packages.nix | 2 ++ 3 files changed, 17 insertions(+), 15 deletions(-) rename pkgs/{tools/admin => development/python-modules}/certbot/default.nix (73%) diff --git a/pkgs/tools/admin/certbot/default.nix b/pkgs/development/python-modules/certbot/default.nix similarity index 73% rename from pkgs/tools/admin/certbot/default.nix rename to pkgs/development/python-modules/certbot/default.nix index 67d698a64fa7..335e62e6a8b8 100644 --- a/pkgs/tools/admin/certbot/default.nix +++ b/pkgs/development/python-modules/certbot/default.nix @@ -1,12 +1,12 @@ { lib -, buildPythonApplication +, buildPythonPackage , fetchFromGitHub , ConfigArgParse, acme, configobj, cryptography, distro, josepy, parsedatetime, pyRFC3339, pyopenssl, pytz, requests, six, zope_component, zope_interface , dialog, mock, gnureadline -, pytest_xdist, pytest, dateutil +, pytest_xdist, pytest, pytestCheckHook, dateutil }: -buildPythonApplication rec { +buildPythonPackage rec { pname = "certbot"; version = "1.6.0"; @@ -17,6 +17,8 @@ buildPythonApplication rec { sha256 = "1y0m5qm853i6pcpb2mrf8kjkr9wr80mdrx1qmck38ayvr2v2p5lc"; }; + sourceRoot = "source/${pname}"; + propagatedBuildInputs = [ ConfigArgParse acme @@ -36,21 +38,19 @@ buildPythonApplication rec { buildInputs = [ dialog mock gnureadline ]; - checkInputs = [ pytest_xdist pytest dateutil ]; + checkInputs = [ + dateutil + pytest + pytestCheckHook + pytest_xdist + ]; - preBuild = '' - cd certbot - ''; - - postInstall = '' - for i in $out/bin/*; do - wrapProgram "$i" --prefix PYTHONPATH : "$PYTHONPATH" \ - --prefix PATH : "${dialog}/bin:$PATH" - done - ''; + pytestFlagsArray = [ "-o cache_dir=$(mktemp -d)" ]; doCheck = true; + makeWrapperArgs = [ "--prefix PATH : ${dialog}/bin" ]; + meta = with lib; { homepage = src.meta.homepage; description = "ACME client that can obtain certs and extensibly update server configurations"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a03a861002ed..880233945915 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -11592,7 +11592,7 @@ in ogre = ogre1_10; }; - certbot = python3Packages.callPackage ../tools/admin/certbot { }; + certbot = python3.pkgs.toPythonApplication python3.pkgs.certbot; caf = callPackage ../development/libraries/caf {}; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 661966cb7681..133cdacd2bc9 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -585,6 +585,8 @@ in { cdecimal = callPackage ../development/python-modules/cdecimal { }; + certbot = callPackage ../development/python-modules/certbot { }; + certbot-dns-cloudflare = callPackage ../development/python-modules/certbot-dns-cloudflare { }; certbot-dns-rfc2136 = callPackage ../development/python-modules/certbot-dns-rfc2136 { }; From 718a4496dfbbb8f6917e9737807e10e4b074dbf4 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Thu, 9 Jul 2020 14:11:25 +0200 Subject: [PATCH 3/4] certbot: add certbot.withPlugins This can be used to wrap certbot to include some plugins. certbot.withPlugins has a similar calling convention as python*.withPackages: ``` certbot.withPlugins (cp: [ cp.certbot-dns-foo ]) ``` --- .../development/python-modules/certbot/default.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkgs/development/python-modules/certbot/default.nix b/pkgs/development/python-modules/certbot/default.nix index 335e62e6a8b8..79e5c3288b7f 100644 --- a/pkgs/development/python-modules/certbot/default.nix +++ b/pkgs/development/python-modules/certbot/default.nix @@ -1,5 +1,6 @@ { lib , buildPythonPackage +, python, runCommand , fetchFromGitHub , ConfigArgParse, acme, configobj, cryptography, distro, josepy, parsedatetime, pyRFC3339, pyopenssl, pytz, requests, six, zope_component, zope_interface , dialog, mock, gnureadline @@ -51,6 +52,19 @@ buildPythonPackage rec { makeWrapperArgs = [ "--prefix PATH : ${dialog}/bin" ]; + # certbot.withPlugins has a similar calling convention as python*.withPackages + # it gets invoked with a lambda, and invokes that lambda with the python package set matching certbot's: + # certbot.withPlugins (cp: [ cp.certbot-dns-foo ]) + passthru.withPlugins = f: let + pythonEnv = python.withPackages f; + + in runCommand "certbot-with-plugins" { + } '' + mkdir -p $out/bin + cd $out/bin + ln -s ${pythonEnv}/bin/certbot + ''; + meta = with lib; { homepage = src.meta.homepage; description = "ACME client that can obtain certs and extensibly update server configurations"; From 9d86dea4174ad6c1ef907582d0919533c65eb7ed Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Thu, 9 Jul 2020 14:14:32 +0200 Subject: [PATCH 4/4] certbot-full: init --- pkgs/top-level/all-packages.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 880233945915..e11d1f7af145 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -11594,6 +11594,12 @@ in certbot = python3.pkgs.toPythonApplication python3.pkgs.certbot; + certbot-full = certbot.withPlugins (cp: with cp; [ + certbot-dns-cloudflare + certbot-dns-rfc2136 + certbot-dns-route53 + ]); + caf = callPackage ../development/libraries/caf {}; # CGAL 5 has API changes