feat(docs): Add home-manager module options to the docs

This commit is contained in:
Jalil David Salamé Messina 2024-01-15 14:43:46 +01:00
parent 8e27b9ee60
commit b036df017c
Signed by: jalil
GPG key ID: F016B9E770737A0B
6 changed files with 22 additions and 11 deletions

View file

@ -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";

View file

@ -1,3 +1,4 @@
# Summary
- [Module Options](./options.md)
- [NixOS Module Options](./nixos-options.md)
- [Home Manager Module Options](./home-options.md)

3
docs/src/home-options.md Normal file
View file

@ -0,0 +1,3 @@
# Home Manager Module Options
Here you will find the home-manager options and their default values (if they have any).

View file

@ -0,0 +1,3 @@
# NixOS Module Options
Here you will find the NixOS module options and their default values (if they have any).

View file

@ -1,3 +0,0 @@
# Module Options
Here you will find the module options and their default values (if they have any).

View file

@ -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