wlib.modules.makeWrapper
modules/makeWrapper
This module is made possible by: birdee
An implementation of the makeWrapper interface via type safe module options.
Allows you to choose one of several underlying implementations of the makeWrapper interface.
Imported by wlib.modules.default
Wherever the type includes DAG you can mentally substitute this with attrsOf
Wherever the type includes DAL or DAG list you can mentally substitute this with listOf
However they also take items of the form { data, name ? null, before ? [], after ? [] }
This allows you to specify that values are added to the wrapper before or after another value.
The sorting occurs across ALL the options, thus you can target items in any DAG or DAL within this module from any other DAG or DAL option within this module.
The DAG/DAL entries in this module also accept an extra field, esc-fn ? null
If defined, it will be used instead of the value of options.escapingFunction to escape that value.
It also has a set of submodule options under config.wrapperVariants which allow you
to duplicate the effects to other binaries from the package, or add extra ones.
Each one contains an enable option, and a mirror option.
They also contain the same options the top level module does, however if mirror is true,
as it is by default, then they will inherit the defaults from the top level as well.
They also have their own package, exePath, and binName options, with sensible defaults.
addFlag
Wrapper for
–add-flag ARG
Prepend the single argument ARG to the invocation of the executable, before any command-line arguments.
This option takes a list. To group them more strongly, option may take a list of lists as well.
Any entry can instead be of type { data, name ? null, before ? [], after ? [], esc-fn ? null }
This will cause it to be added to the DAG.
If no name is provided, it cannot be targeted.
Type:
list of spec with main field: data of (str|path|drv or list of str|path|drv)
Default:
[ ]
Example:
[
"-v"
"-f"
[
"--config"
./storePath.cfg
]
[
"-s"
"idk"
]
]
Declared by:
addFlag.*.esc-fn
A per-item override of the default string escape function
Type: null or (function that evaluates to a(n) string)
Default:
null
Declared by:
appendFlag
–append-flag ARG
Append the single argument ARG to the invocation of the executable, after any command-line arguments.
This option takes a list. To group them more strongly, option may take a list of lists as well.
Any entry can instead be of type { data, name ? null, before ? [], after ? [], esc-fn ? null }
This will cause it to be added to the DAG.
If no name is provided, it cannot be targeted.
Type:
list of spec with main field: data of (str|path|drv or list of str|path|drv)
Default:
[ ]
Example:
[
"-v"
"-f"
[
"--config"
./storePath.cfg
]
[
"-s"
"idk"
]
]
Declared by:
appendFlag.*.esc-fn
A per-item override of the default string escape function
Type: null or (function that evaluates to a(n) string)
Default:
null
Declared by:
argv0
–argv0 NAME
Set the name of the executed process to NAME. If unset or null, defaults to EXECUTABLE.
overrides the setting from argv0type if set.
Type: null or string
Default:
null
Declared by:
argv0type
argv0 overrides this option if not null or unset
Both shell and the nix implementations
ignore this option, as the shell always resolves $0
However, the binary implementation will use this option
Values:
"inherit":
The executable inherits argv0 from the wrapper.
Use instead of --argv0 '$0'.
"resolve":
If argv0 does not include a “/” character, resolve it against PATH.
- Function form:
str -> str
This one works only in the nix implementation. The others will treat it as inherit
Rather than calling exec, you get the command plus all its flags supplied, and you can choose how to run it.
e.g. command_string: "eval \"$(${command_string})\";
It will also be added to the end of the overall DAL,
with the name NIX_RUN_MAIN_PACKAGE
Thus, you can make things run after it, but by default it is still last.
Type: one of “resolve”, “inherit” or function that evaluates to a(n) string
Default:
"inherit"
Declared by:
chdir
–chdir DIR
Change working directory before running the executable.
Use instead of --run "cd DIR".
Type:
list of spec with main field: data of str|path|drv
Default:
[ ]
Declared by:
chdir.*.esc-fn
A per-item override of the default string escape function
Type: null or (function that evaluates to a(n) string)
Default:
null
Declared by:
env
Environment variables to set in the wrapper.
This option takes a set.
Any entry can instead be of type { data, before ? [], after ? [], esc-fn ? null }
This will cause it to be added to the DAG, which will cause the resulting wrapper argument to be sorted accordingly
Type:
attribute set of spec with main field: data of (null or str|path|drv)
Default:
{ }
Example:
{
XDG_DATA_HOME = "/somewhere/on/your/machine";
}
Declared by:
env.<name>.esc-fn
A per-item override of the default string escape function
Type: null or (function that evaluates to a(n) string)
Default:
null
Declared by:
envDefault
Environment variables to set in the wrapper.
Like env, but only adds the variable if not already set in the environment.
This option takes a set.
Any entry can instead be of type { data, before ? [], after ? [], esc-fn ? null }
This will cause it to be added to the DAG, which will cause the resulting wrapper argument to be sorted accordingly
Type:
attribute set of spec with main field: data of (null or str|path|drv)
Default:
{ }
Example:
{
XDG_DATA_HOME = "/only/if/not/set";
}
Declared by:
envDefault.<name>.esc-fn
A per-item override of the default string escape function
Type: null or (function that evaluates to a(n) string)
Default:
null
Declared by:
escapingFunction
The function to use to escape shell values
Caution: When using shell or binary implementations,
these will be expanded at BUILD time.
You should probably leave this as is when using either of those implementations.
However, when using the nix implementation, they will expand at runtime!
Which means wlib.escapeShellArgWithEnv may prove to be a useful substitute!
Type: function that evaluates to a(n) string
Default:
lib.escapeShellArg
Declared by:
extraPackages
Additional packages to add to the wrapper’s runtime PATH. This is useful if the wrapped program needs additional libraries or tools to function correctly.
Adds all its entries to the DAG under the name NIX_PATH_ADDITIONS
Type: list of package
Default:
[ ]
Declared by:
flagSeparator
Separator between flag names and values when generating args from flags.
" " for --flag value or "=" for --flag=value
If null (the default), they will always be separate, sequential arguments,
even if not interpolated by a shell (such as with the "binary" implementation)
Type: null or string
Default:
null
Declared by:
flags
Flags to pass to the wrapper. The key is the flag name, the value is the flag value. If the value is true, the flag will be passed without a value. If the value is false or null, the flag will not be passed. If the value is a list, the flag will be passed multiple times with each value.
This option takes a set.
Any entry can instead be of type { data, before ? [], after ? [], esc-fn ? null, sep ? null, ifs ? null }
The sep field may be used to override the value of config.flagSeparator
The ifs field is relevant when your value is a list.
flags."--myflag" = { ifs = null; sep = "="; data = [ "a" "b" "c" ]; }
will result in
--myflag=a --myflag=b --myflag=c
flags."--myflag" = { ifs = ","; sep = "="; data = [ "a" "b" "c" ]; }
will result in
--myflag=a,b,c
Type:
attribute set of spec with main field: data of (null or boolean or str|path|drv or list of str|path|drv)
Default:
{ }
Example:
{
"--config" = ./nixPath;
}
Declared by:
flags.<name>.esc-fn
A per-item override of the default string escape function
Type: null or (function that evaluates to a(n) string)
Default:
null
Declared by:
flags.<name>.ifs
If null, and a list is provided, the key-value pairs will be repeated.
If a string is provided, it will instead be the key, followed by the main separator, followed by the list joined with this value as the separator.
flags."--myflag" = { ifs = null; sep = "="; data = [ "a" "b" "c" ]; }
will result in
--myflag=a --myflag=b --myflag=c
flags."--myflag" = { ifs = ","; sep = "="; data = [ "a" "b" "c" ]; }
will result in
--myflag=a,b,c
Type: null or string
Default:
null
Declared by:
flags.<name>.sep
A per-item override of the default separator used for flags and their values
Type: null or string
Default:
null
Declared by:
prefixContent
[
[ "ENV" "SEP" "FILE" ]
]
Prefix ENV with contents of FILE and SEP at build time.
Also accepts sets like the other options
[
[ "ENV" "SEP" "FILE" ]
{ data = [ "ENV" "SEP" "FILE" ]; esc-fn = lib.escapeShellArg; /* name, before, after */ }
]
Type:
list of spec with main field: data of (List of length 3)
Default:
[ ]
Declared by:
prefixContent.*.esc-fn
A per-item override of the default string escape function
Type: null or (function that evaluates to a(n) string)
Default:
null
Declared by:
prefixVar
–prefix ENV SEP VAL
Prefix ENV with VAL, separated by SEP.
Type:
list of spec with main field: data of (List of length 3)
Default:
[ ]
Example:
[
[
"LD_LIBRARY_PATH"
":"
"${lib.makeLibraryPath (with pkgs; [ ... ])}"
]
[
"PATH"
":"
"${lib.makeBinPath (with pkgs; [ ... ])}"
]
]
Declared by:
prefixVar.*.esc-fn
A per-item override of the default string escape function
Type: null or (function that evaluates to a(n) string)
Default:
null
Declared by:
runShell
–run COMMAND
Run COMMAND before executing the main program.
This option takes a list.
Any entry can instead be of type { data, name ? null, before ? [], after ? [], esc-fn ? null }
This will cause it to be added to the DAG.
If no name is provided, it cannot be targeted.
Type:
list of spec with main field: data of str|path|drv
Default:
[ ]
Declared by:
runShell.*.esc-fn
A per-item override of the default string escape function
Type: null or (function that evaluates to a(n) string)
Default:
null
Declared by:
runtimeLibraries
Additional libraries to add to the wrapper’s runtime LD_LIBRARY_PATH. This is useful if the wrapped program needs additional libraries or tools to function correctly.
Adds all its entries to the DAG under the name NIX_LIB_ADDITIONS
Type: list of package
Default:
[ ]
Declared by:
suffixContent
[
[ "ENV" "SEP" "FILE" ]
]
Suffix ENV with SEP and then the contents of FILE at build time.
Also accepts sets like the other options
[
[ "ENV" "SEP" "FILE" ]
{ data = [ "ENV" "SEP" "FILE" ]; esc-fn = lib.escapeShellArg; /* name, before, after */ }
]
Type:
list of spec with main field: data of (List of length 3)
Default:
[ ]
Declared by:
suffixContent.*.esc-fn
A per-item override of the default string escape function
Type: null or (function that evaluates to a(n) string)
Default:
null
Declared by:
suffixVar
–suffix ENV SEP VAL
Suffix ENV with VAL, separated by SEP.
Type:
list of spec with main field: data of (List of length 3)
Default:
[ ]
Example:
[
[
"LD_LIBRARY_PATH"
":"
"${lib.makeLibraryPath (with pkgs; [ ... ])}"
]
[
"PATH"
":"
"${lib.makeBinPath (with pkgs; [ ... ])}"
]
]
Declared by:
suffixVar.*.esc-fn
A per-item override of the default string escape function
Type: null or (function that evaluates to a(n) string)
Default:
null
Declared by:
unsetVar
–unset VAR
Remove VAR from the environment.
Type:
list of spec with main field: data of string
Default:
[ ]
Declared by:
unsetVar.*.esc-fn
A per-item override of the default string escape function
Type: null or (function that evaluates to a(n) string)
Default:
null
Declared by:
wrapperFunction
Arguments:
This option takes a function receiving the following arguments:
module arguments + pkgs.callPackage
{
config,
wlib,
... # <- anything you can get from pkgs.callPackage
}
This is the function used to process the wrapper arguments.
By default, it is wlib.makeWrapper.wrapAll
It will be called with the normal module arguments + pkgs.callPackage arguments
The module calls it, and places the result in config.buildCommand.makeWrapper with lib.mkOptionDefault priority.
The relative path to the thing to wrap is config.wrapperPaths.input
This function is to return a string of build commands which create a result at config.wrapperPaths.placeholder
Type: function that evaluates to a(n) string
Default:
<function, args: {callPackage?, config, pkgs?, wrapperImplementation?}>
Declared by:
wrapperImplementation
the nix implementation is the default
It makes the escapingFunction most relevant.
This is because the shell and binary implementations
use pkgs.makeWrapper or pkgs.makeBinaryWrapper,
and arguments to these functions are passed at BUILD time.
So, generally, when not using the nix implementation,
you should always prefer to have escapingFunction
set to lib.escapeShellArg.
However, if you ARE using the nix implementation,
using wlib.escapeShellArgWithEnv will allow you
to use $ expansions, which will expand at runtime.
binary implementation is useful for programs
which are likely to be used in “shebangs”,
as macos will not allow scripts to be used for these.
However, it is more limited. It does not have access to
runShell, prefixContent, and suffixContent options.
Chosing binary will thus cause values in those options to be ignored.
Type: one of “nix”, “shell”, “binary”
Default:
"nix"
Declared by:
wrapperVariants
Allows for you to apply the wrapper options to multiple binaries from config.package (or elsewhere)
They are called variants because they are the same options as the top level makeWrapper options, however, their defaults mirror the values of the top level options.
Meaning if you set config.env.MYVAR = "HELLO" at the top level,
then the following statement would be true by default:
config.wrapperVariants.foo.env.MYVAR.data == "HELLO"
They achieve this by receiving mainConfig and mainOpts via specialArgs,
which contain config and options from the top level.
Type: attribute set of (submodule)
Default:
{ }
Declared by:
wrapperVariants.<name>.addFlag
Wrapper for
–add-flag ARG
Prepend the single argument ARG to the invocation of the executable, before any command-line arguments.
This option takes a list. To group them more strongly, option may take a list of lists as well.
Any entry can instead be of type { data, name ? null, before ? [], after ? [], esc-fn ? null }
This will cause it to be added to the DAG.
If no name is provided, it cannot be targeted.
Type:
list of spec with main field: data of (str|path|drv or list of str|path|drv)
Default:
[ ]
Example:
[
"-v"
"-f"
[
"--config"
./storePath.cfg
]
[
"-s"
"idk"
]
]
Declared by:
wrapperVariants.<name>.addFlag.*.esc-fn
A per-item override of the default string escape function
Type: null or (function that evaluates to a(n) string)
Default:
null
Declared by:
wrapperVariants.<name>.appendFlag
–append-flag ARG
Append the single argument ARG to the invocation of the executable, after any command-line arguments.
This option takes a list. To group them more strongly, option may take a list of lists as well.
Any entry can instead be of type { data, name ? null, before ? [], after ? [], esc-fn ? null }
This will cause it to be added to the DAG.
If no name is provided, it cannot be targeted.
Type:
list of spec with main field: data of (str|path|drv or list of str|path|drv)
Default:
[ ]
Example:
[
"-v"
"-f"
[
"--config"
./storePath.cfg
]
[
"-s"
"idk"
]
]
Declared by:
wrapperVariants.<name>.appendFlag.*.esc-fn
A per-item override of the default string escape function
Type: null or (function that evaluates to a(n) string)
Default:
null
Declared by:
wrapperVariants.<name>.argv0
–argv0 NAME
Set the name of the executed process to NAME. If unset or null, defaults to EXECUTABLE.
overrides the setting from argv0type if set.
Type: null or string
Default:
null
Declared by:
wrapperVariants.<name>.argv0type
argv0 overrides this option if not null or unset
Both shell and the nix implementations
ignore this option, as the shell always resolves $0
However, the binary implementation will use this option
Values:
"inherit":
The executable inherits argv0 from the wrapper.
Use instead of --argv0 '$0'.
"resolve":
If argv0 does not include a “/” character, resolve it against PATH.
- Function form:
str -> str
This one works only in the nix implementation. The others will treat it as inherit
Rather than calling exec, you get the command plus all its flags supplied, and you can choose how to run it.
e.g. command_string: "eval \"$(${command_string})\";
It will also be added to the end of the overall DAL,
with the name NIX_RUN_MAIN_PACKAGE
Thus, you can make things run after it, but by default it is still last.
Type: one of “resolve”, “inherit” or function that evaluates to a(n) string
Default:
"inherit"
Declared by:
wrapperVariants.<name>.binDir
the directory the wrapped result will be placed into, with the name indicated by the binName option
i.e. "${placeholder outputName}/<THIS_VALUE>/${binName}"
Type: null or non-empty line
Default:
"bin"
Declared by:
wrapperVariants.<name>.binName
The name of the file to output to ${placeholder config.outputName}${config.wrapperPaths.relDir}
Type: non-empty line
Default:
"‹name›"
Declared by:
wrapperVariants.<name>.chdir
–chdir DIR
Change working directory before running the executable.
Use instead of --run "cd DIR".
Type:
list of spec with main field: data of str|path|drv
Default:
[ ]
Declared by:
wrapperVariants.<name>.chdir.*.esc-fn
A per-item override of the default string escape function
Type: null or (function that evaluates to a(n) string)
Default:
null
Declared by:
wrapperVariants.<name>.enable
Enables the wrapping of this variant
Type: boolean
Default:
true
Declared by:
wrapperVariants.<name>.env
Environment variables to set in the wrapper.
This option takes a set.
Any entry can instead be of type { data, before ? [], after ? [], esc-fn ? null }
This will cause it to be added to the DAG, which will cause the resulting wrapper argument to be sorted accordingly
Type:
attribute set of spec with main field: data of (null or str|path|drv)
Default:
{ }
Example:
{
XDG_DATA_HOME = "/somewhere/on/your/machine";
}
Declared by:
wrapperVariants.<name>.env.<name>.esc-fn
A per-item override of the default string escape function
Type: null or (function that evaluates to a(n) string)
Default:
null
Declared by:
wrapperVariants.<name>.envDefault
Environment variables to set in the wrapper.
Like env, but only adds the variable if not already set in the environment.
This option takes a set.
Any entry can instead be of type { data, before ? [], after ? [], esc-fn ? null }
This will cause it to be added to the DAG, which will cause the resulting wrapper argument to be sorted accordingly
Type:
attribute set of spec with main field: data of (null or str|path|drv)
Default:
{ }
Example:
{
XDG_DATA_HOME = "/only/if/not/set";
}
Declared by:
wrapperVariants.<name>.envDefault.<name>.esc-fn
A per-item override of the default string escape function
Type: null or (function that evaluates to a(n) string)
Default:
null
Declared by:
wrapperVariants.<name>.escapingFunction
The function to use to escape shell values
Caution: When using shell or binary implementations,
these will be expanded at BUILD time.
You should probably leave this as is when using either of those implementations.
However, when using the nix implementation, they will expand at runtime!
Which means wlib.escapeShellArgWithEnv may prove to be a useful substitute!
Type: function that evaluates to a(n) string
Default:
lib.escapeShellArg
Declared by:
wrapperVariants.<name>.exePath
The location within the package of the thing to wrap.
Type: null or non-empty line
Default:
"bin/‹name›"
Declared by:
wrapperVariants.<name>.extraPackages
Additional packages to add to the wrapper’s runtime PATH. This is useful if the wrapped program needs additional libraries or tools to function correctly.
Adds all its entries to the DAG under the name NIX_PATH_ADDITIONS
Type: list of package
Default:
[ ]
Declared by:
wrapperVariants.<name>.flagSeparator
Separator between flag names and values when generating args from flags.
" " for --flag value or "=" for --flag=value
If null (the default), they will always be separate, sequential arguments,
even if not interpolated by a shell (such as with the "binary" implementation)
Type: null or string
Default:
null
Declared by:
wrapperVariants.<name>.flags
Flags to pass to the wrapper. The key is the flag name, the value is the flag value. If the value is true, the flag will be passed without a value. If the value is false or null, the flag will not be passed. If the value is a list, the flag will be passed multiple times with each value.
This option takes a set.
Any entry can instead be of type { data, before ? [], after ? [], esc-fn ? null, sep ? null, ifs ? null }
The sep field may be used to override the value of config.flagSeparator
The ifs field is relevant when your value is a list.
flags."--myflag" = { ifs = null; sep = "="; data = [ "a" "b" "c" ]; }
will result in
--myflag=a --myflag=b --myflag=c
flags."--myflag" = { ifs = ","; sep = "="; data = [ "a" "b" "c" ]; }
will result in
--myflag=a,b,c
Type:
attribute set of spec with main field: data of (null or boolean or str|path|drv or list of str|path|drv)
Default:
{ }
Example:
{
"--config" = ./nixPath;
}
Declared by:
wrapperVariants.<name>.flags.<name>.esc-fn
A per-item override of the default string escape function
Type: null or (function that evaluates to a(n) string)
Default:
null
Declared by:
wrapperVariants.<name>.flags.<name>.ifs
If null, and a list is provided, the key-value pairs will be repeated.
If a string is provided, it will instead be the key, followed by the main separator, followed by the list joined with this value as the separator.
flags."--myflag" = { ifs = null; sep = "="; data = [ "a" "b" "c" ]; }
will result in
--myflag=a --myflag=b --myflag=c
flags."--myflag" = { ifs = ","; sep = "="; data = [ "a" "b" "c" ]; }
will result in
--myflag=a,b,c
Type: null or string
Default:
null
Declared by:
wrapperVariants.<name>.flags.<name>.sep
A per-item override of the default separator used for flags and their values
Type: null or string
Default:
null
Declared by:
wrapperVariants.<name>.mirror
Allows the variant to inherit defaults from the top level
Type: boolean
Default:
true
Declared by:
wrapperVariants.<name>.outputName
The derivation output the wrapped binary will be placed into.
Type: non-empty line
Default:
"out"
Declared by:
wrapperVariants.<name>.package
The package to wrap with these options
Type: str|path|drv
Default:
<derivation hello-2.12.2>
Declared by:
wrapperVariants.<name>.prefixContent
[
[ "ENV" "SEP" "FILE" ]
]
Prefix ENV with contents of FILE and SEP at build time.
Also accepts sets like the other options
[
[ "ENV" "SEP" "FILE" ]
{ data = [ "ENV" "SEP" "FILE" ]; esc-fn = lib.escapeShellArg; /* name, before, after */ }
]
Type:
list of spec with main field: data of (List of length 3)
Default:
[ ]
Declared by:
wrapperVariants.<name>.prefixContent.*.esc-fn
A per-item override of the default string escape function
Type: null or (function that evaluates to a(n) string)
Default:
null
Declared by:
wrapperVariants.<name>.prefixVar
–prefix ENV SEP VAL
Prefix ENV with VAL, separated by SEP.
Type:
list of spec with main field: data of (List of length 3)
Default:
[ ]
Example:
[
[
"LD_LIBRARY_PATH"
":"
"${lib.makeLibraryPath (with pkgs; [ ... ])}"
]
[
"PATH"
":"
"${lib.makeBinPath (with pkgs; [ ... ])}"
]
]
Declared by:
wrapperVariants.<name>.prefixVar.*.esc-fn
A per-item override of the default string escape function
Type: null or (function that evaluates to a(n) string)
Default:
null
Declared by:
wrapperVariants.<name>.runShell
–run COMMAND
Run COMMAND before executing the main program.
This option takes a list.
Any entry can instead be of type { data, name ? null, before ? [], after ? [], esc-fn ? null }
This will cause it to be added to the DAG.
If no name is provided, it cannot be targeted.
Type:
list of spec with main field: data of str|path|drv
Default:
[ ]
Declared by:
wrapperVariants.<name>.runShell.*.esc-fn
A per-item override of the default string escape function
Type: null or (function that evaluates to a(n) string)
Default:
null
Declared by:
wrapperVariants.<name>.runtimeLibraries
Additional libraries to add to the wrapper’s runtime LD_LIBRARY_PATH. This is useful if the wrapped program needs additional libraries or tools to function correctly.
Adds all its entries to the DAG under the name NIX_LIB_ADDITIONS
Type: list of package
Default:
[ ]
Declared by:
wrapperVariants.<name>.suffixContent
[
[ "ENV" "SEP" "FILE" ]
]
Suffix ENV with SEP and then the contents of FILE at build time.
Also accepts sets like the other options
[
[ "ENV" "SEP" "FILE" ]
{ data = [ "ENV" "SEP" "FILE" ]; esc-fn = lib.escapeShellArg; /* name, before, after */ }
]
Type:
list of spec with main field: data of (List of length 3)
Default:
[ ]
Declared by:
wrapperVariants.<name>.suffixContent.*.esc-fn
A per-item override of the default string escape function
Type: null or (function that evaluates to a(n) string)
Default:
null
Declared by:
wrapperVariants.<name>.suffixVar
–suffix ENV SEP VAL
Suffix ENV with VAL, separated by SEP.
Type:
list of spec with main field: data of (List of length 3)
Default:
[ ]
Example:
[
[
"LD_LIBRARY_PATH"
":"
"${lib.makeLibraryPath (with pkgs; [ ... ])}"
]
[
"PATH"
":"
"${lib.makeBinPath (with pkgs; [ ... ])}"
]
]
Declared by:
wrapperVariants.<name>.suffixVar.*.esc-fn
A per-item override of the default string escape function
Type: null or (function that evaluates to a(n) string)
Default:
null
Declared by:
wrapperVariants.<name>.unsetVar
–unset VAR
Remove VAR from the environment.
Type:
list of spec with main field: data of string
Default:
[ ]
Declared by:
wrapperVariants.<name>.unsetVar.*.esc-fn
A per-item override of the default string escape function
Type: null or (function that evaluates to a(n) string)
Default:
null
Declared by:
wrapperVariants.<name>.wrapperImplementation
the nix implementation is the default
It makes the escapingFunction most relevant.
This is because the shell and binary implementations
use pkgs.makeWrapper or pkgs.makeBinaryWrapper,
and arguments to these functions are passed at BUILD time.
So, generally, when not using the nix implementation,
you should always prefer to have escapingFunction
set to lib.escapeShellArg.
However, if you ARE using the nix implementation,
using wlib.escapeShellArgWithEnv will allow you
to use $ expansions, which will expand at runtime.
binary implementation is useful for programs
which are likely to be used in “shebangs”,
as macos will not allow scripts to be used for these.
However, it is more limited. It does not have access to
runShell, prefixContent, and suffixContent options.
Chosing binary will thus cause values in those options to be ignored.
Type: one of “nix”, “shell”, “binary”
Default:
"nix"
Declared by:
wrapperVariants.<name>.wrapperPaths.input
The path which is to be wrapped by the wrapperFunction implementation
Type: (read-only) string
Default:
"/nix/store/8qi947kixhz1nw83dkwxm6d0wndprqkj-hello-2.12.2/bin/‹name›"
Declared by:
wrapperVariants.<name>.wrapperPaths.placeholder
The path which the wrapperFunction implementation is to output its result to.
Type: (read-only) string
Default:
"/nix/store/19gsyqqmzj610rk9yi77pg3h4aw6w09v-mdbook-0.5.2/bin/‹name›"
Declared by:
wrapperVariants.<name>.wrapperPaths.relDir
The binary will be output to ${placeholder config.outputName}${config.wrapperPaths.relDir}/${config.binName}
Type: (read-only) string
Default:
"/bin"
Declared by:
wrapperVariants.<name>.wrapperPaths.relPath
The binary will be output to ${placeholder config.outputName}${config.wrapperPaths.relPath}
Type: (read-only) string
Default:
"/bin/‹name›"
Declared by:
Modify this module before import
Should you ever need to redefine config.wrapperFunction, you might have slightly different options!
makeWrapper = import wlib.modules.makeWrapper;
If you import it like shown, you gain the ability to modify it.
You may // (update) the following values into the set you gain from importing the file:
exclude_wrapper = true; to stop it from setting config.buildCommand.makeWrapper
wrapperFunction = ...; to override the default config.wrapperFunction that it sets instead of excluding it.
exclude_meta = true; to stop it from setting any values in config.meta
excluded_options = { ... }; where you may include optionname = true
in order to not define that option.
_file and key: _file changes the value set for the modules imported when you import this module. key is set on the main one if not null.
In order to change these values, you change them in the set before importing the module like so:
imports = [ (import wlib.modules.makeWrapper // { excluded_options.wrapperVariants = true; }) ];