hive: Mark all descriptions as Markdown

mdDoc didn't exist prior to 22.11 so we make it noop there.

Fixes #133.
This commit is contained in:
Zhaofeng Li 2023-01-29 12:19:25 -07:00
parent 9cb8413602
commit 7602e548a7

View file

@ -1,17 +1,18 @@
with builtins; rec { with builtins; rec {
keyType = { lib, name, config, ... }: let keyType = { lib, name, config, ... }: let
inherit (lib) types; inherit (lib) types;
mdDoc = lib.mdDoc or (md: md);
in { in {
options = { options = {
name = lib.mkOption { name = lib.mkOption {
description = '' description = mdDoc ''
File name of the key. File name of the key.
''; '';
default = name; default = name;
type = types.str; type = types.str;
}; };
text = lib.mkOption { text = lib.mkOption {
description = '' description = mdDoc ''
Content of the key. Content of the key.
One of `text`, `keyCommand` and `keyFile` must be set. One of `text`, `keyCommand` and `keyFile` must be set.
''; '';
@ -19,7 +20,7 @@ with builtins; rec {
type = types.nullOr types.str; type = types.nullOr types.str;
}; };
keyFile = lib.mkOption { keyFile = lib.mkOption {
description = '' description = mdDoc ''
Path of the local file to read the key from. Path of the local file to read the key from.
One of `text`, `keyCommand` and `keyFile` must be set. One of `text`, `keyCommand` and `keyFile` must be set.
''; '';
@ -28,7 +29,7 @@ with builtins; rec {
type = types.nullOr types.path; type = types.nullOr types.path;
}; };
keyCommand = lib.mkOption { keyCommand = lib.mkOption {
description = '' description = mdDoc ''
Command to run to generate the key. Command to run to generate the key.
One of `text`, `keyCommand` and `keyFile` must be set. One of `text`, `keyCommand` and `keyFile` must be set.
''; '';
@ -38,14 +39,14 @@ with builtins; rec {
in types.nullOr nonEmptyList; in types.nullOr nonEmptyList;
}; };
destDir = lib.mkOption { destDir = lib.mkOption {
description = '' description = mdDoc ''
Destination directory on the host. Destination directory on the host.
''; '';
default = "/run/keys"; default = "/run/keys";
type = types.path; type = types.path;
}; };
path = lib.mkOption { path = lib.mkOption {
description = '' description = mdDoc ''
Full path to the destination. Full path to the destination.
''; '';
default = "${config.destDir}/${config.name}"; default = "${config.destDir}/${config.name}";
@ -53,28 +54,28 @@ with builtins; rec {
internal = true; internal = true;
}; };
user = lib.mkOption { user = lib.mkOption {
description = '' description = mdDoc ''
The group that will own the file. The group that will own the file.
''; '';
default = "root"; default = "root";
type = types.str; type = types.str;
}; };
group = lib.mkOption { group = lib.mkOption {
description = '' description = mdDoc ''
The group that will own the file. The group that will own the file.
''; '';
default = "root"; default = "root";
type = types.str; type = types.str;
}; };
permissions = lib.mkOption { permissions = lib.mkOption {
description = '' description = mdDoc ''
Permissions to set for the file. Permissions to set for the file.
''; '';
default = "0600"; default = "0600";
type = types.str; type = types.str;
}; };
uploadAt = lib.mkOption { uploadAt = lib.mkOption {
description = '' description = mdDoc ''
When to upload the keys. When to upload the keys.
- pre-activation (default): Upload the keys before activating the new system profile. - pre-activation (default): Upload the keys before activating the new system profile.
@ -93,11 +94,12 @@ with builtins; rec {
# Largely compatible with NixOps/Morph. # Largely compatible with NixOps/Morph.
deploymentOptions = { name, lib, ... }: let deploymentOptions = { name, lib, ... }: let
inherit (lib) types; inherit (lib) types;
mdDoc = lib.mdDoc or (md: md);
in { in {
options = { options = {
deployment = { deployment = {
targetHost = lib.mkOption { targetHost = lib.mkOption {
description = '' description = mdDoc ''
The target SSH node for deployment. The target SSH node for deployment.
By default, the node's attribute name will be used. By default, the node's attribute name will be used.
@ -107,7 +109,7 @@ with builtins; rec {
default = name; default = name;
}; };
targetPort = lib.mkOption { targetPort = lib.mkOption {
description = '' description = mdDoc ''
The target SSH port for deployment. The target SSH port for deployment.
By default, the port is the standard port (22) or taken By default, the port is the standard port (22) or taken
@ -117,7 +119,7 @@ with builtins; rec {
default = null; default = null;
}; };
targetUser = lib.mkOption { targetUser = lib.mkOption {
description = '' description = mdDoc ''
The user to use to log into the remote node. If set to null, the The user to use to log into the remote node. If set to null, the
target user will not be specified in SSH invocations. target user will not be specified in SSH invocations.
''; '';
@ -125,7 +127,7 @@ with builtins; rec {
default = "root"; default = "root";
}; };
allowLocalDeployment = lib.mkOption { allowLocalDeployment = lib.mkOption {
description = '' description = mdDoc ''
Allow the configuration to be applied locally on the host running Allow the configuration to be applied locally on the host running
Colmena. Colmena.
@ -142,7 +144,7 @@ with builtins; rec {
default = false; default = false;
}; };
buildOnTarget = lib.mkOption { buildOnTarget = lib.mkOption {
description = '' description = mdDoc ''
Whether to build the system profiles on the target node itself. Whether to build the system profiles on the target node itself.
When enabled, Colmena will copy the derivation to the target When enabled, Colmena will copy the derivation to the target
@ -162,7 +164,7 @@ with builtins; rec {
default = false; default = false;
}; };
tags = lib.mkOption { tags = lib.mkOption {
description = '' description = mdDoc ''
A list of tags for the node. A list of tags for the node.
Can be used to select a group of nodes for deployment. Can be used to select a group of nodes for deployment.
@ -171,7 +173,7 @@ with builtins; rec {
default = []; default = [];
}; };
keys = lib.mkOption { keys = lib.mkOption {
description = '' description = mdDoc ''
A set of secrets to be deployed to the node. A set of secrets to be deployed to the node.
Secrets are transferred to the node out-of-band and Secrets are transferred to the node out-of-band and
@ -181,7 +183,7 @@ with builtins; rec {
default = {}; default = {};
}; };
replaceUnknownProfiles = lib.mkOption { replaceUnknownProfiles = lib.mkOption {
description = '' description = mdDoc ''
Allow a configuration to be applied to a host running a profile we Allow a configuration to be applied to a host running a profile we
have no knowledge of. By setting this option to false, you reduce have no knowledge of. By setting this option to false, you reduce
the likelyhood of rolling back changes made via another Colmena user. the likelyhood of rolling back changes made via another Colmena user.
@ -197,7 +199,7 @@ with builtins; rec {
default = true; default = true;
}; };
privilegeEscalationCommand = lib.mkOption { privilegeEscalationCommand = lib.mkOption {
description = '' description = mdDoc ''
Command to use to elevate privileges when activating the new profiles on SSH hosts. Command to use to elevate privileges when activating the new profiles on SSH hosts.
This is used on SSH hosts when `deployment.targetUser` is not `root`. This is used on SSH hosts when `deployment.targetUser` is not `root`.
@ -212,28 +214,29 @@ with builtins; rec {
# Hive-wide options # Hive-wide options
metaOptions = { lib, ... }: let metaOptions = { lib, ... }: let
inherit (lib) types; inherit (lib) types;
mdDoc = lib.mdDoc or (md: md);
in { in {
options = { options = {
name = lib.mkOption { name = lib.mkOption {
description = '' description = mdDoc ''
The name of the configuration. The name of the configuration.
''; '';
type = types.str; type = types.str;
default = "hive"; default = "hive";
}; };
description = lib.mkOption { description = lib.mkOption {
description = '' description = mdDoc ''
A short description for the configuration. A short description for the configuration.
''; '';
type = types.str; type = types.str;
default = "A Colmena Hive"; default = "A Colmena Hive";
}; };
nixpkgs = lib.mkOption { nixpkgs = lib.mkOption {
description = '' description = mdDoc ''
The pinned Nixpkgs package set. Accepts one of the following: The pinned Nixpkgs package set. Accepts one of the following:
- A path to a Nixpkgs checkout - A path to a Nixpkgs checkout
- The Nixpkgs lambda (e.g., import <nixpkgs>) - The Nixpkgs lambda (e.g., import \<nixpkgs\>)
- An initialized Nixpkgs attribute set - An initialized Nixpkgs attribute set
This option must be specified when using Flakes. This option must be specified when using Flakes.
@ -242,21 +245,21 @@ with builtins; rec {
default = null; default = null;
}; };
nodeNixpkgs = lib.mkOption { nodeNixpkgs = lib.mkOption {
description = '' description = mdDoc ''
Node-specific Nixpkgs pins. Node-specific Nixpkgs pins.
''; '';
type = types.attrsOf types.unspecified; type = types.attrsOf types.unspecified;
default = {}; default = {};
}; };
nodeSpecialArgs = lib.mkOption { nodeSpecialArgs = lib.mkOption {
description = '' description = mdDoc ''
Node-specific special args. Node-specific special args.
''; '';
type = types.attrsOf types.unspecified; type = types.attrsOf types.unspecified;
default = {}; default = {};
}; };
machinesFile = lib.mkOption { machinesFile = lib.mkOption {
description = '' description = mdDoc ''
Use the machines listed in this file when building this hive configuration. Use the machines listed in this file when building this hive configuration.
If your Colmena host has nix configured to allow for remote builds If your Colmena host has nix configured to allow for remote builds
@ -280,7 +283,7 @@ with builtins; rec {
type = types.nullOr types.path; type = types.nullOr types.path;
}; };
specialArgs = lib.mkOption { specialArgs = lib.mkOption {
description = '' description = mdDoc ''
A set of special arguments to be passed to NixOS modules. A set of special arguments to be passed to NixOS modules.
This will be merged into the `specialArgs` used to evaluate This will be merged into the `specialArgs` used to evaluate
@ -290,7 +293,7 @@ with builtins; rec {
type = types.attrsOf types.unspecified; type = types.attrsOf types.unspecified;
}; };
allowApplyAll = lib.mkOption { allowApplyAll = lib.mkOption {
description = '' description = mdDoc ''
Whether to allow deployments without a node filter set. Whether to allow deployments without a node filter set.
If set to false, a node filter must be specified with `--on` when If set to false, a node filter must be specified with `--on` when