From fcacd589592db131f1e0cf5e166ae2c9fd3f1d30 Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Mon, 23 Dec 2024 15:43:08 +0000 Subject: [PATCH] lib/tests: simplify access to default `system` --- flake-modules/lib.nix | 4 +++- lib/tests.nix | 9 ++++----- tests/main.nix | 5 ++++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/flake-modules/lib.nix b/flake-modules/lib.nix index c905482b2e..2e606f5128 100644 --- a/flake-modules/lib.nix +++ b/flake-modules/lib.nix @@ -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: `.lib.${system}.helpers` has been moved to `.lib.nixvim` and no longer depends on a specific system" self.lib.nixvim; diff --git a/lib/tests.nix b/lib/tests.nix index 168d9e3cde..b4179631eb 100644 --- a/lib/tests.nix +++ b/lib/tests.nix @@ -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. @@ -31,7 +30,7 @@ let { name ? null, pkgs ? null, - system ? defaultPkgs.stdenv.hostPlatform.system, + system ? defaultSystem, module, extraSpecialArgs ? { }, }: diff --git a/tests/main.nix b/tests/main.nix index 3b26069865..3801e0cbb6 100644 --- a/tests/main.nix +++ b/tests/main.nix @@ -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 =