mirror of
https://github.com/nix-community/nixvim.git
synced 2025-11-08 19:46:06 +01:00
tests/all-package-defaults: recursively collect package options into submodules
Co-authored-by: Matt Sturgeon <matt@sturgeon.me.uk>
This commit is contained in:
parent
983e45ff2f
commit
4024aa47f0
1 changed files with 19 additions and 6 deletions
|
|
@ -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")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue