From 4814147442cd3f12f8160ecad9e36751f68cdc22 Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Sat, 24 Aug 2024 20:03:45 +0100 Subject: [PATCH] modules/test: add `config` and `options` passthrus This should make inspection of tests a little easier. --- modules/top-level/test.nix | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/modules/top-level/test.nix b/modules/top-level/test.nix index 13f55bfb..dad0f45a 100644 --- a/modules/top-level/test.nix +++ b/modules/top-level/test.nix @@ -1,6 +1,7 @@ { pkgs, config, + options, lib, ... }: @@ -66,7 +67,20 @@ in in { test.derivation = - pkgs.runCommandNoCCLocal cfg.name { nativeBuildInputs = [ config.finalPackage ]; } + pkgs.runCommandNoCCLocal cfg.name + { + nativeBuildInputs = [ config.finalPackage ]; + + # Allow inspecting the test's module a little from the repl + # e.g. + # :lf . + # :p checks.x86_64-linux.test-1.passthru.entries.modules-autocmd.passthru.entries.example.passthru.config.extraConfigLua + # + # Yes, three levels of passthru is cursed. + passthru = { + inherit config options; + }; + } ( # First check warnings/assertions, then run nvim lib.optionalString (errors != "") ''