From c82517fc12d949ea726da05da025b827c9a7be7a Mon Sep 17 00:00:00 2001 From: David Arnold Date: Sat, 9 Jul 2022 15:41:15 -0500 Subject: [PATCH] ref: reduce eval.nix contract - documentation contratcts can now bypass the eval.nix iface - enabled by:9bd5e7bb2540664fe1c728c85f80375fe0cbf9fa --- flake.nix | 16 ++++++++++++++-- src/nix/hive/eval.nix | 26 -------------------------- 2 files changed, 14 insertions(+), 28 deletions(-) diff --git a/flake.nix b/flake.nix index 0ab785f..37e00c6 100644 --- a/flake.nix +++ b/flake.nix @@ -33,12 +33,24 @@ # Full user manual manual = let + suppressModuleArgsDocs = { lib, ... }: { + options = { + _module.args = lib.mkOption { + internal = true; + }; + }; + }; colmena = self.packages.${system}.colmena; deploymentOptionsMd = (pkgs.nixosOptionsDoc { - options = evalNix.docs.deploymentOptions pkgs; + inherit (pkgs.lib.evalModules { + modules = [ colmenaOptions.deploymentOptions suppressModuleArgsDocs]; + specialArgs = { name = "nixos"; nodes = {}; }; + }) options; }).optionsCommonMark; metaOptionsMd = (pkgs.nixosOptionsDoc { - options = evalNix.docs.metaOptions pkgs; + inherit (pkgs.lib.evalModules { + modules = [ colmenaOptions.metaOptions suppressModuleArgsDocs]; + }) options; }).optionsCommonMark; in pkgs.callPackage ./manual { inherit colmena deploymentOptionsMd metaOptionsMd; diff --git a/src/nix/hive/eval.nix b/src/nix/hive/eval.nix index a0e489f..d859c79 100644 --- a/src/nix/hive/eval.nix +++ b/src/nix/hive/eval.nix @@ -195,14 +195,6 @@ let nodes = uncheckedNodes; }; - suppressModuleArgsDocs = { lib, ... }: { - options = { - _module.args = lib.mkOption { - internal = true; - }; - }; - }; - # Add required config Key here since we don't want to eval nixpkgs metaConfigKeys = [ "name" "description" @@ -221,22 +213,4 @@ in { meta = hive.meta; nixosModules = { inherit (colmenaOptions) deploymentOptions; }; - - docs = { - deploymentOptions = pkgs: let - eval = pkgs.lib.evalModules { - modules = [ colmenaOptions.deploymentOptions suppressModuleArgsDocs ]; - specialArgs = { - name = "nixos"; - nodes = {}; - }; - }; - in eval.options; - - metaOptions = pkgs: let - eval = pkgs.lib.evalModules { - modules = [ colmenaOptions.metaOptions suppressModuleArgsDocs ]; - }; - in eval.options; - }; }