From cb2b76c1a9ec067ed0c449080f4973fecf8532ef Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Fri, 27 Sep 2024 02:49:44 +0100 Subject: [PATCH] docs/home-manager: eval options without checking config definitions By default `lib.evalModules` will check all config definitions match a declared option (or a freeform type), leading to errors like: error: The option `wrapRc' does not exist. Setting `_module.freeformType` or `_module.check` will disable this, allowing us to evaluate the option declaration without checking the config definitions. --- docs/default.nix | 8 ++++++-- wrappers/hm.nix | 8 -------- wrappers/modules/hm.nix | 5 +++++ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/docs/default.nix b/docs/default.nix index 50185d80..70300c9f 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -42,8 +42,12 @@ let ]; }; - hmOptions = builtins.removeAttrs (lib.evalModules { modules = [ ../wrappers/modules/hm.nix ]; }) - .options [ "_module" ]; + hmOptions = builtins.removeAttrs (lib.evalModules { + modules = [ + ../wrappers/modules/hm.nix + { _module.check = false; } # Ignore missing option declarations + ]; + }).options [ "_module" ]; options-json = (pkgs.nixosOptionsDoc { diff --git a/wrappers/hm.nix b/wrappers/hm.nix index ce2b9b42..48f10c2c 100644 --- a/wrappers/hm.nix +++ b/wrappers/hm.nix @@ -22,14 +22,6 @@ let }; modules = [ ./modules/hm.nix - # FIXME: this can't go in ./modules/hm.nix because we eval that module in the docs _without_ nixvim's modules - { - _file = ./hm.nix; - config = { - wrapRc = lib.mkOptionDefault false; - impureRtp = lib.mkOptionDefault true; - }; - } ]; }; in diff --git a/wrappers/modules/hm.nix b/wrappers/modules/hm.nix index 42da95bb..3d4dac35 100644 --- a/wrappers/modules/hm.nix +++ b/wrappers/modules/hm.nix @@ -13,4 +13,9 @@ }; imports = [ ./enable.nix ]; + + config = { + wrapRc = lib.mkOptionDefault false; + impureRtp = lib.mkOptionDefault true; + }; }