From 71df507159dde0f7f5ac6874a813c486786ec0e7 Mon Sep 17 00:00:00 2001 From: Emily Date: Sat, 1 Jul 2023 07:14:03 +0100 Subject: [PATCH] treewide: convert options with tables to Markdown The Markdown options processor cannot handle rendering tables to DocBook. This could be fixed, but as we won't be using the DocBook output for long I just removed them for now in the interest of expediency; they were all well-suited to being description lists showing option types anyway, apart from one awkward case in the form of trayer, which also had ad-hoc syntax for enumerating acceptable values in the documentation. Since the types aren't actually used for option processing anyway, I changed them to use `enum` and similar to give a single description of the acceptable values without a big table. --- modules/programs/lf.nix | 16 ++++------ modules/programs/vim.nix | 14 +++------ modules/services/trayer.nix | 61 +++++++++++-------------------------- 3 files changed, 28 insertions(+), 63 deletions(-) diff --git a/modules/programs/lf.nix b/modules/programs/lf.nix index 8f0a07cb8..a30425c53 100644 --- a/modules/programs/lf.nix +++ b/modules/programs/lf.nix @@ -75,23 +75,19 @@ in { number = true; ratios = "1:1:2"; }; - description = '' + description = lib.mdDoc '' An attribute set of lf settings. The attribute names and corresponding values must be among the following supported options. - ${concatStringsSep "\n" (mapAttrsToList (n: v: '' - - ${n} - ${v.description} - + {var}`${n}` + : ${v.description} '') knownSettings)} - See the lf documentation for detailed descriptions of these options. - Note, use previewer to set lf's - previewer option, and - extraConfig for any other option not listed above. + Use {option}`programs.lf.previewer.*` to set lf's + {var}`previewer` option, and + [](#opt-programs.lf.extraConfig) for any other option not listed above. All string options are quoted with double quotes. ''; }; diff --git a/modules/programs/vim.nix b/modules/programs/vim.nix index e4d993a61..8a7618dd1 100644 --- a/modules/programs/vim.nix +++ b/modules/programs/vim.nix @@ -89,23 +89,19 @@ in { background = "dark"; } ''; - description = '' + description = lib.mdDoc '' At attribute set of Vim settings. The attribute names and corresponding values must be among the following supported options. - ${concatStringsSep "\n" (mapAttrsToList (n: v: '' - - ${n} - ${v.description} - + {var}`${n}` + : ${v.description} '') knownSettings)} - See the Vim documentation for detailed descriptions of these - options. Note, use extraConfig to - manually set any options not listed above. + options. Use [](#opt-programs.vim.extraConfig) to manually + set any options not listed above. ''; }; diff --git a/modules/services/trayer.nix b/modules/services/trayer.nix index 0621c55e6..1ac930d43 100644 --- a/modules/services/trayer.nix +++ b/modules/services/trayer.nix @@ -6,52 +6,44 @@ let boolTrue = { type = types.bool; - values = "true|false"; - default = "true"; + default = true; }; number0 = { type = types.int; - values = "number"; - default = "0"; + default = 0; }; knownSettings = { edge = { - type = types.str; - values = "left|right|top|bottom|none"; + type = types.enum [ "left" "right" "top" "bottom" "none" ]; default = "bottom"; }; align = { - type = types.str; - values = "left|right|center"; + type = types.enum [ "left" "right" "center" ]; default = "center"; }; margin = number0; widthtype = { - type = types.str; - values = "request|pixel|percent"; + type = types.enum [ "request" "pixel" "percent" ]; default = "percent"; }; width = { type = types.int; - values = "number"; - default = "100"; + default = 100; }; heighttype = { - type = types.str; - values = "request|pixel"; + type = types.enum [ "request" "pixel" ]; default = "pixel"; }; height = { type = types.int; - values = "number"; - default = "26"; + default = 26; }; SetDockType = boolTrue; @@ -60,27 +52,23 @@ let transparent = { type = types.bool; - values = "true|false"; - default = "false"; + default = false; }; alpha = { type = types.int; - values = "number"; - default = "127"; + default = 127; }; tint = { type = types.str; - values = "int"; default = "0xFFFFFFFF"; }; distance = number0; distancefrom = { - type = types.str; - values = "left|right|top|bottom"; + type = types.enum [ "left" "right" "top" "bottom" ]; default = "top"; }; @@ -89,9 +77,8 @@ let padding = number0; monitor = { - values = "number|primary"; - type = types.str; - default = "0"; + type = types.either types.ints.unsigned (types.enum [ "primary" ]); + default = 0; }; iconspacing = number0; @@ -117,28 +104,14 @@ in { settings = mkOption { type = with types; attrsOf (nullOr (either str (either bool int))); - description = '' + description = lib.mdDoc '' Trayer configuration as a set of attributes. Further details can be - found at . + found in [trayer's README](https://github.com/sargon/trayer-srg/blob/master/README). - - - - Property Name - Type - Values - Default - - ${concatStringsSep "\n" (mapAttrsToList (n: v: '' - - ${n} - ${v.type.description} - ${v.values} - ${v.default} - + {var}`${n}` + : ${v.type.description} (default: `${builtins.toJSON v.default}`) '') knownSettings)} - ''; default = { }; example = literalExpression ''