mirror of
https://gitlab.com/rensa-nix/devshell.git
synced 2025-12-12 06:10:07 +01:00
chore: add initial nixmkdocs setup and improve documentation
This commit is contained in:
parent
e76bef387e
commit
695d36a457
11 changed files with 172 additions and 8 deletions
|
|
@ -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"
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,18 +80,36 @@ in {
|
|||
name = mkOption {
|
||||
type = types.str;
|
||||
default = "devshell";
|
||||
description = ''
|
||||
Name of the shell.
|
||||
'';
|
||||
};
|
||||
packages = mkOption {
|
||||
type = types.listOf types.package;
|
||||
default = [];
|
||||
description = ''
|
||||
Packages to install into the devshell.
|
||||
'';
|
||||
};
|
||||
enterShellCommands = mkOption {
|
||||
type = types.attrsOf entryType;
|
||||
default = {};
|
||||
description = ''
|
||||
Commands to run when entering the shell.
|
||||
'';
|
||||
example = {
|
||||
"hello".text = "echo Hello world";
|
||||
};
|
||||
};
|
||||
interactiveShellCommands = mkOption {
|
||||
type = types.attrsOf entryType;
|
||||
default = {};
|
||||
description = ''
|
||||
Commands to run when entering an interactive shell.
|
||||
'';
|
||||
example = {
|
||||
"hello".text = "echo Hello world";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue