Skip to content

Commit

Permalink
lib/tests: simplify access to default system
Browse files Browse the repository at this point in the history
  • Loading branch information
MattSturgeon committed Jan 15, 2025
1 parent 06f3b52 commit beea0b6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 3 additions & 1 deletion flake-modules/lib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
{ pkgs, system, ... }:
{
# NOTE: this is the publicly documented flake output we've had for a while
check = pkgs.callPackage ../lib/tests.nix { inherit self; };
check = pkgs.callPackage ../lib/tests.nix {
inherit lib self system;
};

# NOTE: no longer needs to be per-system
helpers = lib.warn "nixvim: `<nixvim>.lib.${system}.helpers` has been moved to `<nixvim>.lib.nixvim` and no longer depends on a specific system" self.lib.nixvim;
Expand Down
9 changes: 4 additions & 5 deletions lib/tests.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
self,
pkgs,
lib ? pkgs.lib,
...
system,
lib,
}:
let
defaultPkgs = pkgs;
defaultSystem = system;

# Create a nix derivation from a nixvim executable.
# The build phase simply consists in running the provided nvim binary.
Expand All @@ -31,7 +30,7 @@ let
{
name ? null,
pkgs ? null,
system ? defaultPkgs.stdenv.hostPlatform.system,
system ? defaultSystem,
module,
extraSpecialArgs ? { },
}:
Expand Down
5 changes: 4 additions & 1 deletion tests/main.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
pkgs,
pkgsUnfree,
self,
system,
}:
let
fetchTests = callTest ./fetch-tests.nix { };
test-derivation = callPackage ../lib/tests.nix { inherit self; };
test-derivation = callPackage ../lib/tests.nix {
inherit lib self system;
};
inherit (test-derivation) mkTestDerivationFromNixvimModule;

moduleToTest =
Expand Down

0 comments on commit beea0b6

Please sign in to comment.