about summary refs log tree commit diff
path: root/pkgs/development/python-modules/certbot
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2020-07-09 14:11:25 +0200
committerFlorian Klink <flokli@flokli.de>2020-07-22 12:07:15 +0200
commit718a4496dfbbb8f6917e9737807e10e4b074dbf4 (patch)
tree7a85a9f9f17391621db51fa32980fc21a893bf55 /pkgs/development/python-modules/certbot
parent8ad62167e82cc6fb43c044a157da1387fa29eea2 (diff)
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 ])
```
Diffstat (limited to 'pkgs/development/python-modules/certbot')
-rw-r--r--pkgs/development/python-modules/certbot/default.nix14
1 files changed, 14 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/certbot/default.nix b/pkgs/development/python-modules/certbot/default.nix
index 335e62e6a8b8b..79e5c3288b7fd 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";