From d7ea56adf32ae5e7fc3ab9d8a9f2f6b31d5ca879 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Wed, 4 Sep 2024 14:49:00 +0800 Subject: [PATCH] wrapper-manager-fds/modules: add option for additional modules inclusion in documentation --- docs/default.nix | 3 ++- modules/env/common.nix | 14 ++++++++++++++ modules/env/home-manager/default.nix | 2 +- modules/env/nixos/default.nix | 5 +++-- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/docs/default.nix b/docs/default.nix index f66da68..55d16fe 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -3,6 +3,7 @@ let in { pkgs ? import sources.nixos-unstable { }, + extraModules ? [ ], }: let @@ -62,7 +63,7 @@ let wrapperManagerLib = (import ../. { }).lib; wmOptionsDoc = evalDoc { - modules = [ ../modules/wrapper-manager ]; + modules = [ ../modules/wrapper-manager ] ++ extraModules; includeModuleSystemOptions = true; }; diff --git a/modules/env/common.nix b/modules/env/common.nix index 71bfd91..b4c4111 100644 --- a/modules/env/common.nix +++ b/modules/env/common.nix @@ -135,6 +135,20 @@ in documentation = { manpage.enable = lib.mkEnableOption "manpage output"; html.enable = lib.mkEnableOption "HTML output"; + + extraModules = lib.mkOption { + type = with lib.types; listOf deferredModule; + description = '' + List of extra wrapper-manager modules to be included as part of the + documentation. + ''; + default = [ ]; + example = lib.literalExpression '' + [ + ./modules/wrapper-manager + ] + ''; + }; }; }; } diff --git a/modules/env/home-manager/default.nix b/modules/env/home-manager/default.nix index ab821f8..daa409f 100644 --- a/modules/env/home-manager/default.nix +++ b/modules/env/home-manager/default.nix @@ -7,7 +7,7 @@ let cfg = config.wrapper-manager; - wmDocs = import ../../../docs { inherit pkgs; }; + wmDocs = import ../../../docs { inherit pkgs; inherit (cfg.documentation) extraModules; }; in { imports = [ ../common.nix ]; diff --git a/modules/env/nixos/default.nix b/modules/env/nixos/default.nix index e6090c5..cb618d2 100644 --- a/modules/env/nixos/default.nix +++ b/modules/env/nixos/default.nix @@ -7,7 +7,7 @@ let cfg = config.wrapper-manager; - wmDocs = import ../../../docs { inherit pkgs; }; + wmDocs = import ../../../docs { inherit pkgs; inherit (cfg.documentation) extraModules; }; in { imports = [ ../common.nix ]; @@ -33,7 +33,8 @@ in } (lib.mkIf (cfg.packages != { }) { - environment.systemPackages = lib.mapAttrsToList (_: wrapper: wrapper.build.toplevel) cfg.packages; + environment.systemPackages = + lib.mapAttrsToList (_: wrapper: wrapper.build.toplevel) cfg.packages; }) ]; }