chore: add initial nixmkdocs setup and improve documentation

This commit is contained in:
technofab 2025-08-21 13:46:24 +02:00
parent e76bef387e
commit 695d36a457
No known key found for this signature in database
11 changed files with 172 additions and 8 deletions

View file

@ -42,6 +42,23 @@
name = mkOption {
type = types.str;
default = name;
description = ''
Name of the environment variable, usually already set to `<name>`.
'';
};
desc = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
Description of the env var, can be shown in the menu.
'';
};
visible = mkOption {
type = types.bool;
default = true;
description = ''
Whether to include this env var and it's description in the menu.
'';
};
value = mkOption {
type = with types;
@ -52,13 +69,18 @@
package
]);
default = null;
example = "hello";
description = ''
Any value to convert to a string and set the env variable to.
There is no evaluation of the value, for that see [eval](#envnameeval).
'';
};
eval = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
Like value but not evaluated by Bash. This allows to inject other
Like value but evaluated by Bash. This allows to inject other
variable names or even commands using the `$()` notation.
'';
example = "$OTHER_VAR";
@ -70,8 +92,8 @@
description = ''
Prepend to PATH-like environment variables.
For example name = "PATH"; prefix = "bin"; will expand the path of
./bin and prepend it to the PATH, separated by ':'.
For example `name = "PATH"; prefix = "bin";` will expand the path of
`./bin` and prepend it to the `PATH`, separated by `:`.
'';
example = "bin";
};
@ -79,7 +101,9 @@
unset = mkOption {
type = types.bool;
default = false;
description = ''Unset the env variable'';
description = ''
Unset the env variable.
'';
};
};
});
@ -87,7 +111,9 @@ in {
options.env = mkOption {
type = types.attrsOf envType;
default = {};
description = '''';
description = ''
Manage environment variables.
'';
};
config = {
@ -95,5 +121,6 @@ in {
"XDG_DATA_DIRS".eval = "$DEVSHELL_DIR/share:\${XDG_DATA_DIRS-}";
};
enterShellCommands."env".text = concatStringsSep "\n" (map envToBash (builtins.attrValues config.env));
# TODO: collect all env vars, then add them to the menu if they have a description and "visibile == true"
};
}