summary refs log tree commit diff
path: root/nixos/modules/virtualisation/nixos-containers.nix
diff options
context:
space:
mode:
authorpennae <github@quasiparticle.net>2022-07-28 23:19:15 +0200
committerpennae <github@quasiparticle.net>2022-07-30 15:16:34 +0200
commit2e751c0772b9d48ff6923569adfa661b030ab6a2 (patch)
tree0accd740380b7b7fe3ea5965a3a4517674e79260 /nixos/modules/virtualisation/nixos-containers.nix
parent52b0ad17e3727fe0c3ca028787128ede5fb86352 (diff)
downloadnixpkgs-2e751c0772b9d48ff6923569adfa661b030ab6a2.tar
nixpkgs-2e751c0772b9d48ff6923569adfa661b030ab6a2.tar.gz
nixpkgs-2e751c0772b9d48ff6923569adfa661b030ab6a2.tar.bz2
nixpkgs-2e751c0772b9d48ff6923569adfa661b030ab6a2.tar.lz
nixpkgs-2e751c0772b9d48ff6923569adfa661b030ab6a2.tar.xz
nixpkgs-2e751c0772b9d48ff6923569adfa661b030ab6a2.tar.zst
nixpkgs-2e751c0772b9d48ff6923569adfa661b030ab6a2.zip
treewide: automatically md-convert option descriptions
the conversion procedure is simple:

 - find all things that look like options, ie calls to either `mkOption`
   or `lib.mkOption` that take an attrset. remember the attrset as the
   option
 - for all options, find a `description` attribute who's value is not a
   call to `mdDoc` or `lib.mdDoc`
 - textually convert the entire value of the attribute to MD with a few
   simple regexes (the set from mdize-module.sh)
 - if the change produced a change in the manual output, discard
 - if the change kept the manual unchanged, add some text to the
   description to make sure we've actually found an option. if the
   manual changes this time, keep the converted description

this procedure converts 80% of nixos options to markdown. around 2000
options remain to be inspected, but most of those fail the "does not
change the manual output check": currently the MD conversion process
does not faithfully convert docbook tags like <code> and <package>, so
any option using such tags will not be converted at all.
Diffstat (limited to 'nixos/modules/virtualisation/nixos-containers.nix')
-rw-r--r--nixos/modules/virtualisation/nixos-containers.nix68
1 files changed, 34 insertions, 34 deletions
diff --git a/nixos/modules/virtualisation/nixos-containers.nix b/nixos/modules/virtualisation/nixos-containers.nix
index b9301515712..c9a57cc6d5b 100644
--- a/nixos/modules/virtualisation/nixos-containers.nix
+++ b/nixos/modules/virtualisation/nixos-containers.nix
@@ -293,18 +293,18 @@ let
       mountPoint = mkOption {
         example = "/mnt/usb";
         type = types.str;
-        description = "Mount point on the container file system.";
+        description = lib.mdDoc "Mount point on the container file system.";
       };
       hostPath = mkOption {
         default = null;
         example = "/home/alice";
         type = types.nullOr types.str;
-        description = "Location of the host path to be mounted.";
+        description = lib.mdDoc "Location of the host path to be mounted.";
       };
       isReadOnly = mkOption {
         default = true;
         type = types.bool;
-        description = "Determine whether the mounted path will be accessed in read-only mode.";
+        description = lib.mdDoc "Determine whether the mounted path will be accessed in read-only mode.";
       };
     };
 
@@ -319,16 +319,16 @@ let
       node = mkOption {
         example = "/dev/net/tun";
         type = types.str;
-        description = "Path to device node";
+        description = lib.mdDoc "Path to device node";
       };
       modifier = mkOption {
         example = "rw";
         type = types.str;
-        description = ''
+        description = lib.mdDoc ''
           Device node access modifier. Takes a combination
-          <literal>r</literal> (read), <literal>w</literal> (write), and
-          <literal>m</literal> (mknod). See the
-          <literal>systemd.resource-control(5)</literal> man page for more
+          `r` (read), `w` (write), and
+          `m` (mknod). See the
+          `systemd.resource-control(5)` man page for more
           information.'';
       };
     };
@@ -346,7 +346,7 @@ let
       type = types.nullOr types.str;
       default = null;
       example = "br0";
-      description = ''
+      description = lib.mdDoc ''
         Put the host-side of the veth-pair into the named bridge.
         Only one of hostAddress* or hostBridge can be given.
       '';
@@ -358,22 +358,22 @@ let
           protocol = mkOption {
             type = types.str;
             default = "tcp";
-            description = "The protocol specifier for port forwarding between host and container";
+            description = lib.mdDoc "The protocol specifier for port forwarding between host and container";
           };
           hostPort = mkOption {
             type = types.int;
-            description = "Source port of the external interface on host";
+            description = lib.mdDoc "Source port of the external interface on host";
           };
           containerPort = mkOption {
             type = types.nullOr types.int;
             default = null;
-            description = "Target port of container";
+            description = lib.mdDoc "Target port of container";
           };
         };
       });
       default = [];
       example = [ { protocol = "tcp"; hostPort = 8080; containerPort = 80; } ];
-      description = ''
+      description = lib.mdDoc ''
         List of forwarded ports from host to container. Each forwarded port
         is specified by protocol, hostPort and containerPort. By default,
         protocol is tcp and hostPort and containerPort are assumed to be
@@ -386,7 +386,7 @@ let
       type = types.nullOr types.str;
       default = null;
       example = "10.231.136.1";
-      description = ''
+      description = lib.mdDoc ''
         The IPv4 address assigned to the host interface.
         (Not used when hostBridge is set.)
       '';
@@ -396,7 +396,7 @@ let
       type = types.nullOr types.str;
       default = null;
       example = "fc00::1";
-      description = ''
+      description = lib.mdDoc ''
         The IPv6 address assigned to the host interface.
         (Not used when hostBridge is set.)
       '';
@@ -406,7 +406,7 @@ let
       type = types.nullOr types.str;
       default = null;
       example = "10.231.136.2";
-      description = ''
+      description = lib.mdDoc ''
         The IPv4 address assigned to the interface in the container.
         If a hostBridge is used, this should be given with netmask to access
         the whole network. Otherwise the default netmask is /32 and routing is
@@ -418,7 +418,7 @@ let
       type = types.nullOr types.str;
       default = null;
       example = "fc00::2";
-      description = ''
+      description = lib.mdDoc ''
         The IPv6 address assigned to the interface in the container.
         If a hostBridge is used, this should be given with netmask to access
         the whole network. Otherwise the default netmask is /128 and routing is
@@ -450,7 +450,7 @@ in
     boot.isContainer = mkOption {
       type = types.bool;
       default = false;
-      description = ''
+      description = lib.mdDoc ''
         Whether this NixOS machine is a lightweight container running
         in another NixOS system.
       '';
@@ -459,7 +459,7 @@ in
     boot.enableContainers = mkOption {
       type = types.bool;
       default = true;
-      description = ''
+      description = lib.mdDoc ''
         Whether to enable support for NixOS containers. Defaults to true
         (at no cost if containers are not actually used).
       '';
@@ -471,7 +471,7 @@ in
         {
           options = {
             config = mkOption {
-              description = ''
+              description = lib.mdDoc ''
                 A specification of the desired configuration of this
                 container, as a NixOS module.
               '';
@@ -513,9 +513,9 @@ in
             path = mkOption {
               type = types.path;
               example = "/nix/var/nix/profiles/per-container/webserver";
-              description = ''
+              description = lib.mdDoc ''
                 As an alternative to specifying
-                <option>config</option>, you can specify the path to
+                {option}`config`, you can specify the path to
                 the evaluated NixOS system configuration, typically a
                 symlink to a system profile.
               '';
@@ -525,7 +525,7 @@ in
               type = types.listOf types.str;
               default = [];
               example = [ "CAP_NET_ADMIN" "CAP_MKNOD" ];
-              description = ''
+              description = lib.mdDoc ''
                 Grant additional capabilities to the container.  See the
                 capabilities(7) and systemd-nspawn(1) man pages for more
                 information.
@@ -569,10 +569,10 @@ in
             enableTun = mkOption {
               type = types.bool;
               default = false;
-              description = ''
+              description = lib.mdDoc ''
                 Allows the container to create and setup tunnel interfaces
-                by granting the <literal>NET_ADMIN</literal> capability and
-                enabling access to <literal>/dev/net/tun</literal>.
+                by granting the `NET_ADMIN` capability and
+                enabling access to `/dev/net/tun`.
               '';
             };
 
@@ -594,7 +594,7 @@ in
               type = types.listOf types.str;
               default = [];
               example = [ "eth1" "eth2" ];
-              description = ''
+              description = lib.mdDoc ''
                 The list of interfaces to be moved into the container.
               '';
             };
@@ -603,7 +603,7 @@ in
               type = types.listOf types.str;
               default = [];
               example = [ "eth1" "eth2" ];
-              description = ''
+              description = lib.mdDoc ''
                 The list of host interfaces from which macvlans will be
                 created. For each interface specified, a macvlan interface
                 will be created and moved to the container.
@@ -613,7 +613,7 @@ in
             extraVeths = mkOption {
               type = with types; attrsOf (submodule { options = networkOptions; });
               default = {};
-              description = ''
+              description = lib.mdDoc ''
                 Extra veth-pairs to be created for the container.
               '';
             };
@@ -621,7 +621,7 @@ in
             autoStart = mkOption {
               type = types.bool;
               default = false;
-              description = ''
+              description = lib.mdDoc ''
                 Whether the container is automatically started at boot-time.
               '';
             };
@@ -648,7 +648,7 @@ in
               '';
 
               description =
-                ''
+                lib.mdDoc ''
                   An extra list of directories that is bound to the container.
                 '';
             };
@@ -657,7 +657,7 @@ in
               type = with types; listOf (submodule allowedDeviceOpts);
               default = [];
               example = [ { node = "/dev/net/tun"; modifier = "rw"; } ];
-              description = ''
+              description = lib.mdDoc ''
                 A list of device nodes to which the containers has access to.
               '';
             };
@@ -666,7 +666,7 @@ in
               type = types.listOf types.str;
               default = [];
               example = [ "/var" ];
-              description = ''
+              description = lib.mdDoc ''
                 Mounts a set of tmpfs file systems into the container.
                 Multiple paths can be specified.
                 Valid items must conform to the --tmpfs argument
@@ -678,7 +678,7 @@ in
               type = types.listOf types.str;
               default = [];
               example = [ "--drop-capability=CAP_SYS_CHROOT" ];
-              description = ''
+              description = lib.mdDoc ''
                 Extra flags passed to the systemd-nspawn command.
                 See systemd-nspawn(1) for details.
               '';