From 4024aa47f0b55058dc05d10eb98cb6387b23b690 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sat, 4 Oct 2025 10:48:28 +0200 Subject: [PATCH] tests/all-package-defaults: recursively collect package options into submodules Co-authored-by: Matt Sturgeon --- tests/all-package-defaults.nix | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/tests/all-package-defaults.nix b/tests/all-package-defaults.nix index 2099e71e..45912544 100644 --- a/tests/all-package-defaults.nix +++ b/tests/all-package-defaults.nix @@ -81,6 +81,7 @@ let "akku-scheme-langserver" "muon" "rubyfmt" + "wl-clipboard" # wayland ] ++ lib.optionals (hostPlatform.isDarwin && hostPlatform.isx86_64) [ # As of 2024-07-31, dmd is broken on x86_64-darwin @@ -126,14 +127,26 @@ let isEnabled = p: !(builtins.elem (lib.getName p) disabledTests); isAvailable = lib.meta.availableOn hostPlatform; -in -/* - Collect all derivation-type option defaults in the top-level option set. - NOTE: This doesn't currently recurse into submodule option sets. -*/ + # Collects all visible options, including sub options + collectAllOptions = + options: + lib.concatMap ( + opt: + let + visible = opt.visible or true; + optVisible = if lib.isBool visible then visible else visible == "shallow"; + subOptionsVisible = if lib.isBool visible then visible else visible == "transparent"; + subOptionSet = opt.type.getSubOptions opt.loc; + subOptions = lib.optionals (subOptionSet != { }) (collectAllOptions subOptionSet); + in + lib.optional optVisible opt ++ lib.optionals subOptionsVisible subOptions + ) (lib.collect lib.isOption options); + +in +# Collect all derivation-type option defaults in Nixvim lib.pipe nixvimConfig.options [ - (lib.collect lib.isOption) + collectAllOptions (lib.catAttrs "default")