diff --git a/tests/default.nix b/tests/default.nix index 97d8b4f2..93484f18 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -7,47 +7,43 @@ self, # The flake instance }: let - inherit (self.legacyPackages.${system}) - makeNixvimWithModule - nixvimConfiguration - ; + autoArgs = pkgs // { + inherit + helpers + lib + pkgsUnfree + self + system + ; + inherit (self.legacyPackages.${system}) + makeNixvimWithModule + nixvimConfiguration + ; + inherit (self.lib.${system}.check) + mkTestDerivationFromNvim + mkTestDerivationFromNixvimModule + ; + # Recursive: + inherit callTest callTests; + }; + + callTest = lib.callPackageWith autoArgs; + callTests = lib.callPackagesWith autoArgs; in { - extra-args-tests = import ./extra-args.nix { - inherit pkgs; - inherit makeNixvimWithModule; - }; - extend = import ./extend.nix { inherit pkgs makeNixvimWithModule; }; - extra-files = import ./extra-files.nix { inherit pkgs makeNixvimWithModule; }; - enable-except-in-tests = import ./enable-except-in-tests.nix { - inherit pkgs makeNixvimWithModule; - inherit (self.lib.${system}.check) mkTestDerivationFromNixvimModule; - }; - failing-tests = pkgs.callPackage ./failing-tests.nix { - inherit (self.lib.${system}.check) mkTestDerivationFromNixvimModule; - }; - no-flake = import ./no-flake.nix { - inherit system; - inherit (self.lib.${system}.check) mkTestDerivationFromNvim; - nixvim = "${self}"; - }; - lib-tests = import ./lib-tests.nix { - inherit pkgs helpers; - inherit (pkgs) lib; - }; - maintainers = import ./maintainers.nix { inherit pkgs; }; - plugins-by-name = pkgs.callPackage ./plugins-by-name.nix { inherit nixvimConfiguration; }; - generated = pkgs.callPackage ./generated.nix { }; - package-options = pkgs.callPackage ./package-options.nix { inherit nixvimConfiguration; }; - lsp-all-servers = pkgs.callPackage ./lsp-servers.nix { inherit nixvimConfiguration; }; + extra-args-tests = callTest ./extra-args.nix { }; + extend = callTest ./extend.nix { }; + extra-files = callTest ./extra-files.nix { }; + enable-except-in-tests = callTest ./enable-except-in-tests.nix { }; + failing-tests = callTest ./failing-tests.nix { }; + no-flake = callTest ./no-flake.nix { }; + lib-tests = callTest ./lib-tests.nix { }; + maintainers = callTest ./maintainers.nix { }; + plugins-by-name = callTest ./plugins-by-name.nix { }; + generated = callTest ./generated.nix { }; + package-options = callTest ./package-options.nix { }; + lsp-all-servers = callTest ./lsp-servers.nix { }; } # Tests generated from ./test-sources # Grouped as a number of link-farms in the form { test-1, test-2, ... test-N } -// import ./main.nix { - inherit - lib - pkgs - pkgsUnfree - helpers - ; -} +// callTests ./main.nix { } diff --git a/tests/main.nix b/tests/main.nix index bf435e31..d43eac61 100644 --- a/tests/main.nix +++ b/tests/main.nix @@ -1,13 +1,15 @@ # Collects the various test modules in tests/test-sources/ and groups them into a number of test derivations { - lib ? pkgs.lib, + callPackage, + callTest, helpers, + lib ? pkgs.lib, pkgs, pkgsUnfree, }: let - fetchTests = import ./fetch-tests.nix { inherit lib pkgs helpers; }; - test-derivation = import ../lib/tests.nix { inherit pkgs lib; }; + fetchTests = callTest ./fetch-tests.nix { }; + test-derivation = callPackage ../lib/tests.nix { }; inherit (test-derivation) mkTestDerivationFromNixvimModule; moduleToTest = diff --git a/tests/no-flake.nix b/tests/no-flake.nix index ceacf1dd..9b4e415d 100644 --- a/tests/no-flake.nix +++ b/tests/no-flake.nix @@ -1,6 +1,7 @@ { + nixvim ? "${self}", + self ? throw "either supply `self` or `nixvim`", system, - nixvim, mkTestDerivationFromNvim, }: let