From b036df017c7ff65e8fb7c799eed2f3ff77a8bc85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Mon, 15 Jan 2024 14:43:46 +0100 Subject: [PATCH] feat(docs): Add home-manager module options to the docs --- docs/default.nix | 9 +++++---- docs/src/SUMMARY.md | 3 ++- docs/src/home-options.md | 3 +++ docs/src/nixos-options.md | 3 +++ docs/src/options.md | 3 --- flake.nix | 12 +++++++++--- 6 files changed, 22 insertions(+), 11 deletions(-) create mode 100644 docs/src/home-options.md create mode 100644 docs/src/nixos-options.md delete mode 100644 docs/src/options.md diff --git a/docs/default.nix b/docs/default.nix index 7b3d51e..cc28831 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -1,17 +1,18 @@ -{ pkgs, lib, ... }: +{ pkgs, lib, markdown }: let eval = lib.evalModules { modules = [ ../nixos/options.nix ]; }; - markdown = (pkgs.nixosOptionsDoc { inherit (eval) options; }).optionsCommonMark; + nixos-markdown = (pkgs.nixosOptionsDoc { inherit (eval) options; }).optionsCommonMark; in { - inherit markdown; + markdown = nixos-markdown; docs = pkgs.stdenvNoCC.mkDerivation { name = "nixos-configuration-book"; src = ./.; patchPhase = '' # copy generated options removing the declared by statement - sed '/^\*Declared by:\*$/,/^$/d' <${markdown} >> src/options.md + sed '/^\*Declared by:\*$/,/^$/d' <${markdown} >> src/home-options.md + sed '/^\*Declared by:\*$/,/^$/d' <${nixos-markdown} >> src/nixos-options.md ''; buildPhase = "${pkgs.mdbook}/bin/mdbook build --dest-dir $out"; diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index 4a96554..d66231c 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -1,3 +1,4 @@ # Summary -- [Module Options](./options.md) +- [NixOS Module Options](./nixos-options.md) +- [Home Manager Module Options](./home-options.md) diff --git a/docs/src/home-options.md b/docs/src/home-options.md new file mode 100644 index 0000000..29b1839 --- /dev/null +++ b/docs/src/home-options.md @@ -0,0 +1,3 @@ +# Home Manager Module Options + +Here you will find the home-manager options and their default values (if they have any). diff --git a/docs/src/nixos-options.md b/docs/src/nixos-options.md new file mode 100644 index 0000000..4683c81 --- /dev/null +++ b/docs/src/nixos-options.md @@ -0,0 +1,3 @@ +# NixOS Module Options + +Here you will find the NixOS module options and their default values (if they have any). diff --git a/docs/src/options.md b/docs/src/options.md deleted file mode 100644 index e809c5f..0000000 --- a/docs/src/options.md +++ /dev/null @@ -1,3 +0,0 @@ -# Module Options - -Here you will find the module options and their default values (if they have any). diff --git a/flake.nix b/flake.nix index 62a19e2..9fb58d9 100644 --- a/flake.nix +++ b/flake.nix @@ -29,9 +29,15 @@ inherit (nixpkgs) lib; # Helpers for producing system-specific outputs supportedSystems = [ "x86_64-linux" "aarch64-linux" ]; - forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { pkgs = import nixpkgs { inherit system; }; }); + forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { + inherit system; + pkgs = import nixpkgs { inherit system; }; + }); # Module documentation - doc = forEachSupportedSystem ({ pkgs }: import ./docs { inherit pkgs lib; }); + doc = forEachSupportedSystem ({ pkgs, system }: import ./docs { + inherit (home-config.packages.${system}) markdown; + inherit pkgs lib; + }); in { # Schemas tell Nix about the structure of your flake's outputs @@ -40,7 +46,7 @@ packages = doc; # Nix files formatter (run `nix fmt`) - formatter = forEachSupportedSystem ({ pkgs }: pkgs.nixpkgs-fmt); + formatter = forEachSupportedSystem ({ pkgs, ... }: pkgs.nixpkgs-fmt); nixosModules = let