Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixpkgs-manual-mmdoc, nixos-manual-mmdoc: init #108063

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 1 addition & 23 deletions doc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,7 @@ let

common = import ./common.nix;

lib-docs = import ./doc-support/lib-function-docs.nix {
inherit pkgs nixpkgs;
libsets = [
{ name = "asserts"; description = "assertion functions"; }
{ name = "attrsets"; description = "attribute set functions"; }
{ name = "strings"; description = "string manipulation functions"; }
{ name = "versions"; description = "version string functions"; }
{ name = "trivial"; description = "miscellaneous functions"; }
{ name = "fixedPoints"; baseName = "fixed-points"; description = "explicit recursion functions"; }
{ name = "lists"; description = "list manipulation functions"; }
{ name = "debug"; description = "debugging functions"; }
{ name = "options"; description = "NixOS / nixpkgs option handling"; }
{ name = "path"; description = "path functions"; }
{ name = "filesystem"; description = "filesystem functions"; }
{ name = "fileset"; description = "file set functions"; }
{ name = "sources"; description = "source filtering functions"; }
{ name = "cli"; description = "command-line serialization functions"; }
{ name = "gvariant"; description = "GVariant formatted string serialization functions"; }
{ name = "customisation"; description = "Functions to customise (derivation-related) functions, derivatons, or attribute sets"; }
{ name = "meta"; description = "functions for derivation metadata"; }
{ name = "derivations"; description = "miscellaneous derivation-specific functions"; }
];
};
lib-docs = pkgs.nixpkgs-manual-lib-docs;

epub = pkgs.runCommand "manual.epub" {
nativeBuildInputs = with pkgs; [ libxslt zip ];
Expand Down
29 changes: 25 additions & 4 deletions doc/doc-support/lib-function-locations.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,42 @@
let
revision = pkgs.lib.trivial.revisionWithDefault (nixpkgs.rev or "master");

libDefPos = prefix: set:
skiplist = [
"lib.attrsets.zip"
"lib.lists.crossLists"
"lib.options.literalExample"
"lib.sources.pathIsDirectory"
"lib.sources.pathIsRegularFile"
"lib.sources.pathIsRegularFilereplaceChars"
"lib.sources.pathType"
"lib.strings.isCoercibleToString"
"lib.strings.readPathsFromFile"
"lib.strings.replaceChars"
"lib.trivial.nixpkgsVersion"
];

libDefPos = subsetname: prefix: set:
let
fullName = name:
builtins.concatStringsSep "." (["lib" subsetname] ++ prefix ++ [name]);
in
builtins.concatMap
(name: [{
name = builtins.concatStringsSep "." (prefix ++ [name]);
location = builtins.unsafeGetAttrPos name set;
}] ++ nixpkgsLib.optionals
(builtins.length prefix == 0 && builtins.isAttrs set.${name})
(libDefPos (prefix ++ [name]) set.${name})
) (builtins.attrNames set);
(libDefPos subsetname (prefix ++ [name]) set.${name})
)
(builtins.filter (name: (!(builtins.elem (fullName name) skiplist)))
(builtins.attrNames set))
;

libset = toplib:
builtins.map
(subsetname: {
subsetname = subsetname;
functions = libDefPos [] toplib.${subsetname};
functions = libDefPos subsetname [] toplib.${subsetname};
})
(builtins.map (x: x.name) libsets);

Expand Down
8 changes: 4 additions & 4 deletions nixos/doc/manual/installation/installing.chapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ shows a typical sequence of commands for installing NixOS on an empty hard
drive (here `/dev/sda`). [Example: NixOS Configuration](#ex-config) shows a
corresponding configuration Nix expression.

::: {#ex-partition-scheme-MBR .example}
::: {.example #ex-partition-scheme-MBR}
### Example partition schemes for NixOS on `/dev/sda` (MBR)
```ShellSession
# parted /dev/sda -- mklabel msdos
Expand All @@ -549,7 +549,7 @@ corresponding configuration Nix expression.
```
:::

::: {#ex-partition-scheme-UEFI .example}
::: {.example #ex-partition-scheme-UEFI}
### Example partition schemes for NixOS on `/dev/sda` (UEFI)
```ShellSession
# parted /dev/sda -- mklabel gpt
Expand All @@ -560,7 +560,7 @@ corresponding configuration Nix expression.
```
:::

::: {#ex-install-sequence .example}
::: {.example #ex-install-sequence}
### Commands for Installing NixOS on `/dev/sda`

With a partitioned disk.
Expand All @@ -580,7 +580,7 @@ With a partitioned disk.
```
:::

::: {#ex-config .example}
::: {.example #ex-config}
### Example: NixOS Configuration
```ShellSession
{ config, pkgs, ... }: {
Expand Down
22 changes: 22 additions & 0 deletions pkgs/by-name/ni/nixos-manual-mmdoc-watch/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{ writeScriptBin, python3, inotify-tools } :

writeScriptBin "nixos-manual-mmdoc-watch" ''
killbg() {
for p in "''${pids[@]}" ; do
kill "$p";
done
}
trap killbg EXIT

nix-build . -A nixos-manual-mmdoc

pids=()
${python3}/bin/python -m http.server --directory ./result &
pids+=($!)
trap exit SIGINT

while ${inotify-tools}/bin/inotifywait -e modify -e create doc pkgs/by-name/ni/nixos-manual-mmdoc
do
nix-build . -A nixos-manual-mmdoc
done
''
33 changes: 33 additions & 0 deletions pkgs/by-name/ni/nixos-manual-mmdoc/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{ stdenvNoCC
, lib
, mmdoc
, nixos-doc-src
}:

stdenvNoCC.mkDerivation rec {
name = "nixos-minimal-manual";

src = lib.fileset.toSource rec {
root = nixos-doc-src;
fileset = lib.fileset.fileFilter
(file: file.hasExt "md" || file.hasExt "dot")
nixos-doc-src;
};

dontUnpack = true;

buildCommand = ''
cp -r $src doc
chmod -R u+w doc
cp ${./toc.md} doc/toc.md
${mmdoc}/bin/mmdoc nixos doc $out
'';

meta = with lib; {
description = "NixOS minimal manual";
homepage = "https://github.com/nixos/nixpkgs";
license = licenses.mit;
maintainers = with maintainers; [ ryantm ];
platforms = platforms.unix;
};
}
120 changes: 120 additions & 0 deletions pkgs/by-name/ni/nixos-manual-mmdoc/toc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# NixOS Manual

Version 23.11pre

* [](#preface)
* Installation
* [](#sec-obtaining)
* [](#sec-installation)
* [](#sec-booting-from-usb)
* [](#sec-booting-from-pxe)
* [](#sec-booting-via-kexec)
* [](#sec-installing-virtualbox-guest)
* [](#sec-installing-from-other-distro)
* [](#sec-installing-behind-proxy)
* [](#ch-configuration)
* [](#sec-configuration-syntax)
* [](#sec-configuration-file)
* [](#sec-module-abstractions)
* [](#sec-modularity)
* [](#sec-package-management)
* [](#sec-declarative-package-mgmt)
* [](#sec-ad-hoc-packages)
* [](#sec-user-management)
* [](#ch-file-systems)
* [](#sec-luks-file-systems)
* [](#sec-sshfs-file-systems)
* [](#sec-x11)
* [](#sec-wayland)
* [](#sec-gpu-accel)
* [](#sec-xfce)
* [](#sec-networking)
* [](#sec-networkmanager)
* [](#sec-ssh)
* [](#sec-ipv4)
* [](#sec-ipv6)
* [](#sec-firewall)
* [](#sec-wireless)
* [](#ad-hoc-network-config)
* [](#sec-rename-ifs)
* [](#sec-kernel-config)
* [](#module-services-subversion)
* MODULE_CHAPTERS
* [](#ch-profiles)
* [](#sec-profile-all-hardware)
* [](#sec-profile-base)
* [](#sec-profile-clone-config)
* [](#sec-profile-demo)
* [](#sec-profile-docker-container)
* [](#sec-profile-graphical)
* [](#sec-profile-hardened)
* [](#sec-profile-headless)
* [](#sec-profile-installation-device)
* [](#sec-profile-minimal)
* [](#sec-profile-qemu-guest)
*[](#sec-kubernetes)
* [](#ch-running)
* [](#sec-systemctl)
* [](#sec-rebooting)
* [](#sec-user-sessions)
* [](#sec-cgroups)
* [](#sec-logging)
* [](#sec-nix-gc)
* [](#ch-containers)
* [](#sec-imperative-containers)
* [](#sec-declarative-containers)
* [](#sec-container-networking)
* [](#ch-troubleshooting)
* [](#sec-boot-problems)
* [](#sec-maintenance-mode)
* [](#sec-rollback)
* [](#sec-nix-store-corruption)
* [](#sec-nix-network-issues)
* [](#ch-development)
* [](#sec-getting-sources)
* [](#sec-writing-modules)
* [](#sec-option-declarations)
* [](#sec-option-types)
* [](#sec-option-definitions)
* [](#sec-assertions)
* [](#sec-meta-attributes)
* [](#sec-importing-modules)
* [](#sec-replace-modules)
* [](#sec-freeform-modules)
* [](#sec-settings-options)
* [](#sec-building-parts)
* [](#sec-experimental-bootspec)
* [](#sec-switching-systems)
* [](#sec-unit-handling)
* [](#sec-activation-script)
* [](#sec-writing-documentation)
* [](#sec-nixos-tests)
* [](#sec-writing-nixos-tests)
* [](#sec-running-nixos-tests)
* [](#sec-running-nixos-tests-interactively)
* [](#sec-linking-nixos-tests-to-packages)
* [](#chap-developing-the-test-driver)
* [](#ch-testing-installer)
* [](#chap-contributing)
* [](#ch-options)
* [](#ch-release-notes)
* [](#sec-release-23.11)
* [](#sec-release-23.05)
* [](#sec-release-22.11)
* [](#sec-release-22.05)
* [](#sec-release-21.11)
* [](#sec-release-21.05)
* [](#sec-release-20.09)
* [](#sec-release-20.03)
* [](#sec-release-19.09)
* [](#sec-release-19.03)
* [](#sec-release-18.09)
* [](#sec-release-18.03)
* [](#sec-release-17.09)
* [](#sec-release-17.03)
* [](#sec-release-16.09)
* [](#sec-release-16.03)
* [](#sec-release-15.09)
* [](#sec-release-14.12)
* [](#sec-release-14.04)
* [](#sec-release-13.10)
28 changes: 28 additions & 0 deletions pkgs/by-name/ni/nixpkgs-manual-lib-docs/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{ pkgs
, nixpkgs-doc-lib-function-docs
} :

import nixpkgs-doc-lib-function-docs {
inherit pkgs;
nixpkgs = null;
libsets = [
{ name = "asserts"; description = "assertion functions"; }
{ name = "attrsets"; description = "attribute set functions"; }
{ name = "strings"; description = "string manipulation functions"; }
{ name = "versions"; description = "version string functions"; }
{ name = "trivial"; description = "miscellaneous functions"; }
{ name = "fixedPoints"; baseName = "fixed-points"; description = "explicit recursion functions"; }
{ name = "lists"; description = "list manipulation functions"; }
{ name = "debug"; description = "debugging functions"; }
{ name = "options"; description = "NixOS / nixpkgs option handling"; }
{ name = "path"; description = "path functions"; }
{ name = "filesystem"; description = "filesystem functions"; }
{ name = "fileset"; description = "file set functions"; }
{ name = "sources"; description = "source filtering functions"; }
{ name = "cli"; description = "command-line serialization functions"; }
{ name = "gvariant"; description = "GVariant formatted string serialization functions"; }
{ name = "customisation"; description = "Functions to customise (derivation-related) functions, derivatons, or attribute sets"; }
{ name = "meta"; description = "functions for derivation metadata"; }
{ name = "derivations"; description = "miscellaneous derivation-specific functions"; }
];
}
22 changes: 22 additions & 0 deletions pkgs/by-name/ni/nixpkgs-manual-mmdoc-watch/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{ writeScriptBin, python3, inotify-tools } :

writeScriptBin "nixpkgs-manual-mmdoc-watch" ''
killbg() {
for p in "''${pids[@]}" ; do
kill "$p";
done
}
trap killbg EXIT

nix-build . -A nixpkgs-manual-mmdoc

pids=()
${python3}/bin/python -m http.server --directory ./result &
pids+=($!)
trap exit SIGINT

while ${inotify-tools}/bin/inotifywait -e modify -e create doc pkgs/by-name/ni/nixpkgs-manual-mmdoc
do
nix-build . -A nixpkgs-manual-mmdoc
done
''
36 changes: 36 additions & 0 deletions pkgs/by-name/ni/nixpkgs-manual-mmdoc/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{ stdenvNoCC
, lib
, mmdoc
, nixpkgs-manual-lib-docs
, nixpkgs-doc-src
}:

stdenvNoCC.mkDerivation rec {
name = "nixpkgs-minimal-manual";

src = lib.fileset.toSource rec {
root = nixpkgs-doc-src;
fileset = lib.fileset.fileFilter
(file: file.hasExt "md" || file.hasExt "dot")
nixpkgs-doc-src;
};

dontUnpack = true;

buildCommand = ''
cp -r $src doc
chmod -R u+w doc
cp ${./toc.md} doc/toc.md
mkdir -p doc/functions/library/
cp ${nixpkgs-manual-lib-docs}/*.md doc/functions/library/
${mmdoc}/bin/mmdoc nixpkgs doc $out
'';

meta = with lib; {
description = "Nixpkgs minimal manual";
homepage = "https://github.com/nixos/nixpkgs";
license = licenses.mit;
maintainers = with maintainers; [ ryantm ];
platforms = platforms.unix;
};
}
Loading
Loading