From 2a912c1289eb4ef3e95aa61759820eaa4d37e77a Mon Sep 17 00:00:00 2001 From: Ryan Mulligan Date: Sat, 26 Aug 2023 09:04:31 -0700 Subject: [PATCH] nixpkgs-manual-mmdoc, nixos-manual-mmdoc: init --- doc/default.nix | 24 +-- doc/doc-support/lib-function-locations.nix | 29 +++- .../manual/installation/installing.chapter.md | 8 +- .../ni/nixos-manual-mmdoc-watch/package.nix | 22 +++ .../by-name/ni/nixos-manual-mmdoc/package.nix | 33 ++++ pkgs/by-name/ni/nixos-manual-mmdoc/toc.md | 120 +++++++++++++ .../ni/nixpkgs-manual-lib-docs/package.nix | 28 +++ .../ni/nixpkgs-manual-mmdoc-watch/package.nix | 22 +++ .../ni/nixpkgs-manual-mmdoc/package.nix | 36 ++++ pkgs/by-name/ni/nixpkgs-manual-mmdoc/toc.md | 162 ++++++++++++++++++ .../nixpkgs-manual-mmdoc-watch/default.nix | 22 +++ pkgs/top-level/all-packages.nix | 4 + 12 files changed, 479 insertions(+), 31 deletions(-) create mode 100644 pkgs/by-name/ni/nixos-manual-mmdoc-watch/package.nix create mode 100644 pkgs/by-name/ni/nixos-manual-mmdoc/package.nix create mode 100644 pkgs/by-name/ni/nixos-manual-mmdoc/toc.md create mode 100644 pkgs/by-name/ni/nixpkgs-manual-lib-docs/package.nix create mode 100644 pkgs/by-name/ni/nixpkgs-manual-mmdoc-watch/package.nix create mode 100644 pkgs/by-name/ni/nixpkgs-manual-mmdoc/package.nix create mode 100644 pkgs/by-name/ni/nixpkgs-manual-mmdoc/toc.md create mode 100644 pkgs/tools/nix/nixpkgs-manual-mmdoc-watch/default.nix diff --git a/doc/default.nix b/doc/default.nix index bcbc20b9f983b..0f2a00e5e3eee 100644 --- a/doc/default.nix +++ b/doc/default.nix @@ -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 ]; diff --git a/doc/doc-support/lib-function-locations.nix b/doc/doc-support/lib-function-locations.nix index e6794617fdd89..22cb6f11a16b5 100644 --- a/doc/doc-support/lib-function-locations.nix +++ b/doc/doc-support/lib-function-locations.nix @@ -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); diff --git a/nixos/doc/manual/installation/installing.chapter.md b/nixos/doc/manual/installation/installing.chapter.md index c7deb07352f1c..507dee3c91194 100644 --- a/nixos/doc/manual/installation/installing.chapter.md +++ b/nixos/doc/manual/installation/installing.chapter.md @@ -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 @@ -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 @@ -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. @@ -580,7 +580,7 @@ With a partitioned disk. ``` ::: -::: {#ex-config .example} +::: {.example #ex-config} ### Example: NixOS Configuration ```ShellSession { config, pkgs, ... }: { diff --git a/pkgs/by-name/ni/nixos-manual-mmdoc-watch/package.nix b/pkgs/by-name/ni/nixos-manual-mmdoc-watch/package.nix new file mode 100644 index 0000000000000..313fbb82e5ea9 --- /dev/null +++ b/pkgs/by-name/ni/nixos-manual-mmdoc-watch/package.nix @@ -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 +'' diff --git a/pkgs/by-name/ni/nixos-manual-mmdoc/package.nix b/pkgs/by-name/ni/nixos-manual-mmdoc/package.nix new file mode 100644 index 0000000000000..9304ccbc41768 --- /dev/null +++ b/pkgs/by-name/ni/nixos-manual-mmdoc/package.nix @@ -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; + }; +} diff --git a/pkgs/by-name/ni/nixos-manual-mmdoc/toc.md b/pkgs/by-name/ni/nixos-manual-mmdoc/toc.md new file mode 100644 index 0000000000000..fa3f1b2692810 --- /dev/null +++ b/pkgs/by-name/ni/nixos-manual-mmdoc/toc.md @@ -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) diff --git a/pkgs/by-name/ni/nixpkgs-manual-lib-docs/package.nix b/pkgs/by-name/ni/nixpkgs-manual-lib-docs/package.nix new file mode 100644 index 0000000000000..722b5771ae6af --- /dev/null +++ b/pkgs/by-name/ni/nixpkgs-manual-lib-docs/package.nix @@ -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"; } + ]; +} diff --git a/pkgs/by-name/ni/nixpkgs-manual-mmdoc-watch/package.nix b/pkgs/by-name/ni/nixpkgs-manual-mmdoc-watch/package.nix new file mode 100644 index 0000000000000..52b5b18161eb8 --- /dev/null +++ b/pkgs/by-name/ni/nixpkgs-manual-mmdoc-watch/package.nix @@ -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 +'' diff --git a/pkgs/by-name/ni/nixpkgs-manual-mmdoc/package.nix b/pkgs/by-name/ni/nixpkgs-manual-mmdoc/package.nix new file mode 100644 index 0000000000000..4bff6302522fa --- /dev/null +++ b/pkgs/by-name/ni/nixpkgs-manual-mmdoc/package.nix @@ -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; + }; +} diff --git a/pkgs/by-name/ni/nixpkgs-manual-mmdoc/toc.md b/pkgs/by-name/ni/nixpkgs-manual-mmdoc/toc.md new file mode 100644 index 0000000000000..a6af434dce16c --- /dev/null +++ b/pkgs/by-name/ni/nixpkgs-manual-mmdoc/toc.md @@ -0,0 +1,162 @@ +# Nixpkgs Manual + +Version 23.11pre + +* [](#preface) + +## Using Nixpkgs + +* [](#chap-packageconfig) +* [](#chap-overlays) +* [](#chap-overrides) + +## Nixpkgs Lib + +* Library Functions + * [](#sec-functions-library-asserts) + * [](#sec-functions-library-attrsets) + * [](#sec-functions-library-strings) + * [](#sec-functions-library-versions) + * [](#sec-functions-library-trivial) + * [](#sec-functions-library-fixedPoints) + * [](#sec-functions-library-lists) + * [](#sec-functions-library-debug) + * [](#sec-functions-library-options) + * [](#sec-functions-library-path) + * [](#sec-functions-library-filesystem) + * [](#sec-functions-library-fileset) + * [](#sec-functions-library-sources) + * [](#sec-functions-library-cli) + * [](#sec-functions-library-gvariant) + * [](#sec-generators) + * [](#sec-debug) + * [](#sec-prefer-remote-fetch) + * [](#sec-pkgs-nix-gitignore) + * [](#sec-fileset) +* [](#module-system) + +## Standard Environment + +* [](#chap-stdenv) +* [](#chap-meta) +* [](#chap-multiple-output) +* [](#chap-cross) +* [](#chap-platform-notes) + +## Builders + +* [](#chap-pkgs-fetchers) +* [](#chap-trivial-builders) +* [](#chap-testers) +* [](#chap-special) + * [](#sec-fhs-environments) + * [](#sec-pkgs.makeSetupHook) + * [](#sec-pkgs-mkShell) + * [](#sec-darwin-builder) + * [](#sec-vm-tools) +* [](#chap-images) + * [](#sec-pkgs-appimageTools) + * [](#sec-pkgs-dockerTools) + * [](#sec-pkgs-ociTools) + * [](#sec-pkgs-portableService) + * [](#sec-make-disk-image) + * [](#sec-pkgs-binary-cache) +* Hooks + * [](#setup-hook-autoconf) + * [](#setup-hook-automake) + * [](#setup-hook-autopatchelfhook) + * [](#breakpointhook) + * [](#cmake) + * [](#setup-hook-gdk-pixbuf) + * [](#ghc) + * [](#gnome-platform) + * [](#installshellfiles) + * [](#libiconv-libintl) + * [](#setup-hook-libxml2) + * [](#meson) + * [](#setup-hook-mpi-check) + * [](#ninja) + * [](#sec-patchRcPathHooks) + * [](#setup-hook-perl) + * [](#setup-hook-pkg-config) + * [](#sec-postgresqlTestHook) + * [](#setup-hook-python) + * [](#scons) + * [](#tetex-tex-live) + * [](#unzip) + * [](#validatepkgconfig) + * [](#waf-hook) + * [](#zig-hook) + * [](#xcbuildhook) +* [](#chap-language-support) + * [](#agda) + * [](#android) + * [](#sec-beam) + * [](#sec-bower) + * [](#sec-chicken) + * [](#sec-language-coq) + * [](#crystal) + * [](#cuda) + * [](#cuelang) + * [](#sec-language-dart) + * [](#sec-language-dhall) + * [](#dotnet) + * [](#emscripten) + * [](#sec-language-gnome) + * [](#sec-language-go) + * [](#haskell) + * [](#sec-language-hy) + * [](#idris) + * [](#ios) + * [](#sec-language-java) + * [](#language-javascript) + * [](#lua) + * [](#maven) + * [](#nim) + * [](#sec-language-ocaml) + * [](#sec-octave) + * [](#sec-language-perl) + * [](#sec-php) + * [](#python) + * [](#sec-language-qt) + * [](#r) + * [](#sec-language-ruby) + * [](#rust) + * [](#swift) + * [](#sec-language-texlive) + * [](#titanium) + * [](#vim) +* Packages + * [](#cataclysm-dark-days-ahead) + * [](#sec-citrix) + * [](#dlib) + * [](#sec-eclipse) + * [](#sec-elm) + * [](#sec-emacs) + * [](#sec-firefox) + * [](#sec-fish) + * [](#sec-fuse) + * [](#sec-ibus-typing-booster) + * [](#sec-kakoune) + * [](#sec-linux-kernel) + * [](#locales) + * [](#etc) + * [](#sec-nginx) + * [](#sec-opengl) + * [](#sec-shell-helpers) + * [](#sec-steam) + * [](#sec-urxvt) + * [](#sec-weechat) + * [](#sec-xorg) + +## Development of Nixpkgs + * [](#sec-opening-issues) + +## Contributing to Nixpkgs + +* [](#chap-quick-start) +* [](#chap-conventions) +* [](#chap-submitting-changes) +* [](#chap-vulnerability-roundup) +* [](#chap-reviewing-contributions) +* [](#chap-contributing) diff --git a/pkgs/tools/nix/nixpkgs-manual-mmdoc-watch/default.nix b/pkgs/tools/nix/nixpkgs-manual-mmdoc-watch/default.nix new file mode 100644 index 0000000000000..52b5b18161eb8 --- /dev/null +++ b/pkgs/tools/nix/nixpkgs-manual-mmdoc-watch/default.nix @@ -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 +'' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 02964f0d1fd3f..3888cb86a0d85 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -40193,6 +40193,10 @@ with pkgs; nixos-render-docs = callPackage ../tools/nix/nixos-render-docs { }; + nixos-doc-src = ../../nixos/doc/manual; + nixpkgs-doc-src = ../../doc; + nixpkgs-doc-lib-function-docs = ../../doc/doc-support/lib-function-docs.nix; + nixdoc = callPackage ../tools/nix/nixdoc { }; dnadd = callPackage ../tools/nix/dnadd { };