From 333a3e3927a4cf0952447d94ea48d8f07916cf70 Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Wed, 16 Sep 2020 14:02:42 -0400
Subject: [PATCH] Accept tahoe-lafs as an optional parameter

Fall back to our internal packaging if it is not supplied.

Also, shift towards less use of overlays.  Explicit arguments are better when
possible because they don't induce freaky action at a distance.
---
 default.nix  | 15 +++++++++++++--
 overlays.nix | 11 -----------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/default.nix b/default.nix
index 868ef99..cc526bf 100644
--- a/default.nix
+++ b/default.nix
@@ -3,8 +3,19 @@
 , collectCoverage ? false
 , testSuite ? null
 , trialArgs ? null
+, tahoe-lafs ? null
 }:
-let pkgs' = pkgs.extend (import ./overlays.nix);
-in pkgs'.python27Packages.zkapauthorizer.override {
+let
+  pkgs' = pkgs.extend (import ./overlays.nix);
+  callPackage = pkgs'.python27Packages.callPackage;
+  tahoe-lafs' = (
+    if tahoe-lafs != null
+    then tahoe-lafs
+    else callPackage ./tahoe-lafs.nix { }
+  );
+in
+callPackage ./zkapauthorizer.nix {
+  challenge-bypass-ristretto = callPackage ./python-challenge-bypass-ristretto.nix { };
   inherit hypothesisProfile collectCoverage testSuite trialArgs;
+  tahoe-lafs = tahoe-lafs';
 }
diff --git a/overlays.nix b/overlays.nix
index 3d548fa..a56387c 100644
--- a/overlays.nix
+++ b/overlays.nix
@@ -14,17 +14,6 @@ self: super: {
       # cuts of incompatibilities between libraries with no maintained Python
       # 2 support.
       typing = python-self.callPackage ./typing.nix { };
-
-      # tahoe-lafs in nixpkgs is packaged as an application!  so we have to
-      # re-package it ourselves as a library.
-      tahoe-lafs = python-self.callPackage ./tahoe-lafs.nix { };
-
-      # we depend on the challenge-bypass-ristretto python package, a set of
-      # bindings to the challenge-bypass-ristretto Rust crate.
-      challenge-bypass-ristretto = python-self.callPackage ./python-challenge-bypass-ristretto.nix { };
-
-      # And add ourselves to the collection too.
-      zkapauthorizer = python-self.callPackage ./zkapauthorizer.nix { };
     };
   };
 }
-- 
GitLab