Man pages: Difference between revisions

From NixOS Wiki
imported>Profpatsch
init man page, how to enable development man pages
 
imported>9glenda
Add documentation for Mandoc
 
(6 intermediate revisions by 5 users not shown)
Line 2: Line 2:


See the [https://wiki.archlinux.org/index.php/Man_page Archwiki] and [https://en.wikipedia.org/wiki/Man_page Wikipedia] entries for more information.
See the [https://wiki.archlinux.org/index.php/Man_page Archwiki] and [https://en.wikipedia.org/wiki/Man_page Wikipedia] entries for more information.
== NixOS: Display configuration options ==
The NixOS option system creates a manpage with all options and their documentation.
<syntaxhighlight lang="console">
$ man 5 configuration.nix
</syntaxhighlight>
This is a lightweight alternative to the “Configuration Options” page in <code>nixos-help</code>.
There is also [https://search.nixos.org/options NixOS options] website


== NixOS: Some man pages are missing ==
== NixOS: Some man pages are missing ==
Line 9: Line 20:
The “Linux man-pages project” provides a set of documentation of the Linux programming API, mostly section `3`. You can access them by adding them to your system packages:
The “Linux man-pages project” provides a set of documentation of the Linux programming API, mostly section `3`. You can access them by adding them to your system packages:


<syntaxhighlight>
<syntaxhighlight lang="nix">
environment.systemPackages = [ pkgs.manpages ];
environment.systemPackages = [ pkgs.man-pages pkgs.man-pages-posix ];
</syntaxhighlight>
</syntaxhighlight>


Line 17: Line 28:
Libraries and development utilities might provide additional documentation and manpages. You can add those to your system like this:
Libraries and development utilities might provide additional documentation and manpages. You can add those to your system like this:


<syntaxhighlight>
<syntaxhighlight lang="nix">
documentation.dev.enable = true;
documentation.dev.enable = true;
</syntaxhighlight>
</syntaxhighlight>


See also: the other options in the `documentation` namespace.
See also: the other options in the `documentation` namespace.
== Mandoc as the default man page viewer ==
Mandoc is a set of tools designed for working with mdoc(7), the preferred roff macro language for BSD manual pages, as well as man(7), the historical roff macro language used in UNIX manuals. It can be used as an alternative to man-db.
To use mandoc as the default man page viewer add following code to your config:
<syntaxhighlight lang="nix">
documentation.man = {
  # In order to enable to mandoc man-db has to be disabled.
  man-db.enable = false;
  mandoc.enable = true;
};
</syntaxhighlight>
See also: the [https://mandoc.bsd.lv/ Mandoc website].
=== Apropos ===
See [[Apropos]].

Latest revision as of 21:40, 30 November 2023

Man pages are a form of documentation available on Unix-like systems.

See the Archwiki and Wikipedia entries for more information.

NixOS: Display configuration options

The NixOS option system creates a manpage with all options and their documentation.

$ man 5 configuration.nix

This is a lightweight alternative to the “Configuration Options” page in nixos-help. There is also NixOS options website

NixOS: Some man pages are missing

Development man pages

The “Linux man-pages project” provides a set of documentation of the Linux programming API, mostly section `3`. You can access them by adding them to your system packages:

environment.systemPackages = [ pkgs.man-pages pkgs.man-pages-posix ];

To try it out: man 3 scanf.

Libraries and development utilities might provide additional documentation and manpages. You can add those to your system like this:

documentation.dev.enable = true;

See also: the other options in the `documentation` namespace.

Mandoc as the default man page viewer

Mandoc is a set of tools designed for working with mdoc(7), the preferred roff macro language for BSD manual pages, as well as man(7), the historical roff macro language used in UNIX manuals. It can be used as an alternative to man-db.

To use mandoc as the default man page viewer add following code to your config:

documentation.man = {
  # In order to enable to mandoc man-db has to be disabled.
  man-db.enable = false;
  mandoc.enable = true;
};

See also: the Mandoc website.

Apropos

See Apropos.