From 4dc239c3494518a53d92f8c1cf0af0f42e7131f1 Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Tue, 4 Jan 2022 19:56:31 -0500
Subject: [PATCH] provide a shell where we can run tests, not just linters

---
 shell.nix | 52 +++++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 47 insertions(+), 5 deletions(-)

diff --git a/shell.nix b/shell.nix
index 023fc1b..9388b73 100644
--- a/shell.nix
+++ b/shell.nix
@@ -2,13 +2,55 @@
 # work on Nix 2.3.  It works with Nix 2.5.  I'm not sure about 2.4.
 { ... }@args:
 let
-  tests = import ./tests.nix args;
-  inherit (tests) pkgs;
+  privatestorage = import ./. args;
+  inherit (privatestorage) pkgs mach-nix tahoe-lafs zkapauthorizer;
+
+  pythonVersion = zkapauthorizer.meta.mach-nix.python;
+
+  python = mach-nix.mkPython {
+    inherit (zkapauthorizer.meta.mach-nix) providers;
+    python = pythonVersion;
+    overridesPre = [
+      (
+        self: super: {
+          inherit tahoe-lafs;
+        }
+      )
+    ];
+
+    requirements = let
+      py3 = pythonVersion > "python3";
+      lint = pkgs.lib.optionalString (builtins.trace py3 py3) ''
+# lint
+black
+isort
+flake8
+'';
+      workarounds = ''
+# Mitigate for undetected cryptography dependency
+setuptools_rust
+# And for tomli
+flit_core
+'';
+      testing = ''
+coverage
+fixtures
+testtools
+hypothesis
+'';
+    in
+      ''
+${lint}
+${workarounds}
+${testing}
+${zkapauthorizer.requirements}
+'';
+  };
 in
 pkgs.mkShell {
+  PYTHONDONTWRITEBYTECODE = "1";
+
   buildInputs = [
-    tests.python
-    tests.lint-python
-    pkgs.niv
+    python
   ];
 }
-- 
GitLab