From 2e751c0772b9d48ff6923569adfa661b030ab6a2 Mon Sep 17 00:00:00 2001 From: pennae Date: Thu, 28 Jul 2022 23:19:15 +0200 Subject: 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 and , so any option using such tags will not be converted at all. --- nixos/modules/services/backup/sanoid.nix | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'nixos/modules/services/backup/sanoid.nix') diff --git a/nixos/modules/services/backup/sanoid.nix b/nixos/modules/services/backup/sanoid.nix index 5eb031b2e9f..847b8507f70 100644 --- a/nixos/modules/services/backup/sanoid.nix +++ b/nixos/modules/services/backup/sanoid.nix @@ -12,37 +12,37 @@ let commonOptions = { hourly = mkOption { - description = "Number of hourly snapshots."; + description = lib.mdDoc "Number of hourly snapshots."; type = with types; nullOr ints.unsigned; default = null; }; daily = mkOption { - description = "Number of daily snapshots."; + description = lib.mdDoc "Number of daily snapshots."; type = with types; nullOr ints.unsigned; default = null; }; monthly = mkOption { - description = "Number of monthly snapshots."; + description = lib.mdDoc "Number of monthly snapshots."; type = with types; nullOr ints.unsigned; default = null; }; yearly = mkOption { - description = "Number of yearly snapshots."; + description = lib.mdDoc "Number of yearly snapshots."; type = with types; nullOr ints.unsigned; default = null; }; autoprune = mkOption { - description = "Whether to automatically prune old snapshots."; + description = lib.mdDoc "Whether to automatically prune old snapshots."; type = with types; nullOr bool; default = null; }; autosnap = mkOption { - description = "Whether to automatically take snapshots."; + description = lib.mdDoc "Whether to automatically take snapshots."; type = with types; nullOr bool; default = null; }; @@ -50,7 +50,7 @@ let datasetOptions = rec { use_template = mkOption { - description = "Names of the templates to use for this dataset."; + description = lib.mdDoc "Names of the templates to use for this dataset."; type = types.listOf (types.str // { check = (types.enum (attrNames cfg.templates)).check; description = "configured template name"; @@ -60,9 +60,9 @@ let useTemplate = use_template; recursive = mkOption { - description = '' + description = lib.mdDoc '' Whether to recursively snapshot dataset children. - You can also set this to "zfs" to handle datasets + You can also set this to `"zfs"` to handle datasets recursively in an atomic way without the possibility to override settings for child datasets. ''; @@ -71,7 +71,7 @@ let }; process_children_only = mkOption { - description = "Whether to only snapshot child datasets if recursing."; + description = lib.mdDoc "Whether to only snapshot child datasets if recursing."; type = types.bool; default = false; }; @@ -135,7 +135,7 @@ in config.process_children_only = mkAliasDefinitions (mkDefault options.processChildrenOnly or { }); })); default = { }; - description = "Datasets to snapshot."; + description = lib.mdDoc "Datasets to snapshot."; }; templates = mkOption { @@ -144,14 +144,14 @@ in options = commonOptions; }); default = { }; - description = "Templates for datasets."; + description = lib.mdDoc "Templates for datasets."; }; settings = mkOption { type = types.attrsOf datasetSettingsType; - description = '' + description = lib.mdDoc '' Free-form settings written directly to the config file. See - + for allowed values. ''; }; @@ -160,9 +160,9 @@ in type = types.listOf types.str; default = [ ]; example = [ "--verbose" "--readonly" "--debug" ]; - description = '' + description = lib.mdDoc '' Extra arguments to pass to sanoid. See - + for allowed options. ''; }; -- cgit 1.4.1