diff --git a/default.nix b/default.nix index 5f8c0d7eb8b657ede2ba61cd6920948d5c06b7ee..d07b203acc127f0b9be3dfb43cdf1a4256267b4e 100644 --- a/default.nix +++ b/default.nix @@ -37,6 +37,8 @@ in }; in rec { + inherit pkgs mach-nix; + tahoe-lafs = mach-nix.buildPythonPackage rec { inherit python providers; name = "tahoe-lafs"; diff --git a/shell.nix b/shell.nix index 0f661ebc3692fbf6bfe199abc0cbd8fbd6feaa8e..023fc1bdb969c66f6b0d8da9d0c3b638396b96f1 100644 --- a/shell.nix +++ b/shell.nix @@ -1,17 +1,14 @@ +# Note: Passing arguments through here to customize the environment does not +# work on Nix 2.3. It works with Nix 2.5. I'm not sure about 2.4. +{ ... }@args: let - sources = import nix/sources.nix; + tests = import ./tests.nix args; + inherit (tests) pkgs; in -{ pkgs ? import sources.release2105 {} -, tahoe-lafs-source ? "tahoe-lafs" -}: - let - tests = pkgs.callPackage ./tests.nix { - inherit tahoe-lafs-source; - }; - in - pkgs.mkShell { - packages = [ - tests.python - pkgs.niv - ]; - } +pkgs.mkShell { + buildInputs = [ + tests.python + tests.lint-python + pkgs.niv + ]; +} diff --git a/tests.nix b/tests.nix index c985ce0f41b39c886b67788243835d2ee8605808..f7dc90fb734e097a097e7cef1aa9ae68e2607a11 100644 --- a/tests.nix +++ b/tests.nix @@ -1,24 +1,13 @@ -let - sources = import nix/sources.nix; -in -{ pkgs ? import sources.release2105 {} -, pypiData ? sources.pypi-deps-db -, mach-nix ? import sources.mach-nix { inherit pkgs pypiData; } -, tahoe-lafs-source ? "tahoe-lafs" -, tahoe-lafs-repo ? sources.${tahoe-lafs-source} -, privatestorage ? import ./. { - inherit pkgs pypiData mach-nix; - inherit tahoe-lafs-repo; - } +{ privatestorage ? import ./. args , hypothesisProfile ? null , collectCoverage ? false , testSuite ? null , trialArgs ? null -, -}: - let +, ... +}@args: +let + inherit (privatestorage) pkgs mach-nix zkapauthorizer; inherit (pkgs) lib; - inherit (privatestorage) zkapauthorizer; hypothesisProfile' = if hypothesisProfile == null then "default" else hypothesisProfile; defaultTrialArgs = [ "--rterrors" ] ++ (lib.optional (! collectCoverage) "--jobs=$(($NIX_BUILD_CORES > 8 ? 8 : $NIX_BUILD_CORES))"); trialArgs' = if trialArgs == null then defaultTrialArgs else trialArgs; @@ -38,10 +27,11 @@ in requirements = '' isort black + flake8 ''; }; - in - pkgs.runCommand "zkapauthorizer-tests" { + + tests = pkgs.runCommand "zkapauthorizer-tests" { passthru = { inherit python; }; @@ -65,4 +55,8 @@ in cp -v .coverage.* "$out/coverage" '' } - '' + ''; +in +{ + inherit pkgs python lint-python tests; +}