From 5280360d6ce04364b250f15a1863a7e4fc25b063 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Mon, 18 Jan 2021 23:21:32 +0100 Subject: [PATCH] docs: NixOS and nix-darwin option documentation --- doc/default.nix | 63 ++++++++++++++++++++++++++++++++++++++---- doc/manual.xml | 8 ++++++ nix-darwin/default.nix | 5 +++- nixos/default.nix | 5 +++- 4 files changed, 73 insertions(+), 8 deletions(-) diff --git a/doc/default.nix b/doc/default.nix index 6b8e229aa..8015f1b59 100644 --- a/doc/default.nix +++ b/doc/default.nix @@ -26,27 +26,78 @@ let }]; }; - hmModulesDocs = nmd.buildModulesDocs { + buildModulesDocs = args: + nmd.buildModulesDocs ({ + moduleRootPaths = [ ./.. ]; + mkModuleUrl = path: + "https://github.com/nix-community/home-manager/blob/master/${path}#blob-path"; + channelName = "home-manager"; + } // args); + + hmModulesDocs = buildModulesDocs { modules = import ../modules/modules.nix { inherit lib pkgs; check = false; } ++ [ scrubbedPkgsModule ]; - moduleRootPaths = [ ./.. ]; - mkModuleUrl = path: - "https://github.com/nix-community/home-manager/blob/master/${path}#blob-path"; - channelName = "home-manager"; docBook.id = "home-manager-options"; }; + nixosModuleDocs = buildModulesDocs { + modules = let + nixosModule = module: pkgs.path + "/nixos/modules" + module; + mockedNixos = with lib; { + options = { + environment.pathsToLink = mkSinkUndeclaredOptions { }; + systemd.services = mkSinkUndeclaredOptions { }; + users.users = mkSinkUndeclaredOptions { }; + }; + }; + in [ + ../nixos/default.nix + mockedNixos + (nixosModule "/misc/assertions.nix") + scrubbedPkgsModule + ]; + docBook = { + id = "nixos-options"; + optionIdPrefix = "nixos-opt"; + }; + }; + + nixDarwinModuleDocs = buildModulesDocs { + modules = let + nixosModule = module: pkgs.path + "/nixos/modules" + module; + mockedNixDarwin = with lib; { + options = { + environment.pathsToLink = mkSinkUndeclaredOptions { }; + system.activationScripts.postActivation.text = + mkSinkUndeclaredOptions { }; + users.users = mkSinkUndeclaredOptions { }; + }; + }; + in [ + ../nix-darwin/default.nix + mockedNixDarwin + (nixosModule "/misc/assertions.nix") + scrubbedPkgsModule + ]; + docBook = { + id = "nix-darwin-options"; + optionIdPrefix = "nix-darwin-opt"; + }; + }; + docs = nmd.buildDocBookDocs { pathName = "home-manager"; - modulesDocs = [ hmModulesDocs ]; + modulesDocs = [ hmModulesDocs nixDarwinModuleDocs nixosModuleDocs ]; documentsDirectory = ./.; documentType = "book"; chunkToc = '' + + diff --git a/doc/manual.xml b/doc/manual.xml index 314d7c10a..aa069c86a 100644 --- a/doc/manual.xml +++ b/doc/manual.xml @@ -38,6 +38,14 @@ Configuration Options + + NixOS Module Options + + + + nix-darwin Module Options + + Tools diff --git a/nix-darwin/default.nix b/nix-darwin/default.nix index 12d021743..956695926 100644 --- a/nix-darwin/default.nix +++ b/nix-darwin/default.nix @@ -36,7 +36,7 @@ in home-manager = { useUserPackages = mkEnableOption '' installation of user packages through the - option. + option. ''; useGlobalPkgs = mkEnableOption '' @@ -60,6 +60,9 @@ in users = mkOption { type = types.attrsOf hmModule; default = {}; + # Set as not visible to prevent the entire submodule being included in + # the documentation. + visible = false; description = '' Per-user Home Manager configuration. ''; diff --git a/nixos/default.nix b/nixos/default.nix index e5ca61c02..6645b9068 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -46,7 +46,7 @@ in { home-manager = { useUserPackages = mkEnableOption '' installation of user packages through the - option. + option. ''; useGlobalPkgs = mkEnableOption '' @@ -70,6 +70,9 @@ in { users = mkOption { type = types.attrsOf hmModule; default = { }; + # Set as not visible to prevent the entire submodule being included in + # the documentation. + visible = false; description = '' Per-user Home Manager configuration. '';