Core (builtin) Options set
These are the core options that make everything else possible.
They include the .apply, .eval, and .wrap functions, and the .wrapper itself
They are always imported with every module evaluation.
They are very minimal by design.
The default symlinkScript value provides no options.
The default wrapperFunction is null.
wlib.modules.default provides great values for these options, and creates many more for you to use.
But you may want to wrap your package via different means, provide different options, or provide modules for others to use to help do those things!
Excited to see what ways to use these options everyone comes up with! Docker helpers? BubbleWrap? If it's a derivation, it should be possible!
package
The base package to wrap.
This means config.symlinkScript will be responsible
for inheriting all other files from this package
(like man page, /share, …)
The config.package value given by this option already has all
values from config.overrides applied to it.
Type: package
Declared by:
apply
Function to extend the current configuration with additional modules. Can accept a single module, or a list of modules. Re-evaluates the configuration with the original settings plus the new module(s).
Returns .config from the lib.evalModules result
Type: function that evaluates to a(n) raw value (read only)
Default:
<function>
Declared by:
binName
The name of the binary output by wrapperFunction to $out/bin
If not specified, the default name from the package will be used.
If set as an empty string, symlinkScript or wrapperFunction may behave unpredictably, depending on its implementation.
Type: string
Default:
"hello"
Declared by:
drv
Extra attributes to add to the resulting derivation.
Cannot affect passthru, or outputs. For that,
use config.passthru, or config.outputs instead.
Also cannot override buildCommand.
That is controlled by the config.symlinkScript
and config.sourceStdenv options.
Type: attrsRecursive
Default:
{ }
Declared by:
eval
Function to extend the current configuration with additional modules. Can accept a single module, or a list of modules. Re-evaluates the configuration with the original settings plus the new module(s).
Returns the raw lib.evalModules result
Type: function that evaluates to a(n) raw value (read only)
Default:
<function>
Declared by:
exePath
The relative path to the executable to wrap. i.e. bin/exename
If not specified, the path gained from calling lib.getExe on config.package and subtracting the path to the package will be used.
If set as an empty string, symlinkScript or wrapperFunction may behave unpredictably, depending on its implementation.
Type: string
Default:
"bin/hello"
Declared by:
meta.description
Description of the module.
Accepts either a string, or a set of { pre ? "", post ? "" }
Resulting config value will be a list of { pre, post, file }
Type: string or { pre ? “”, post ? “” } (converted to `[ { pre, post, file } ]`)
Default:
""
Declared by:
meta.maintainers
Maintainers of this module.
Type: list of (open submodule of attrsRecursive)
Default:
[ ]
Declared by:
meta.maintainers.*.email
Type: null or string
Default:
null
meta.maintainers.*.github
GitHub username
Type: string
meta.maintainers.*.githubId
GitHub id
Type: signed integer
meta.maintainers.*.matrix
Matrix ID
Type: null or string
Default:
null
meta.maintainers.*.name
name
Type: string
Default:
"‹name›"
meta.platforms
Supported platforms
Type: list of strings from enum of lib.platforms.all
Default:
"lib.platforms.all"
Example:
[
"x86_64-linux"
"aarch64-linux"
]
Declared by:
outputs
Override the list of nix outputs that get symlinked into the final package.
Default is the value of config.package.outputs or [ "out" ]
Type: list of string
Default:
[
"out"
]
Declared by:
overrides
the list of .override and .overrideAttrs to apply to config.package
Accessing config.package will return the package with all overrides applied.
Accepts a list of { type, data, name ? null, before ? [], after ? [] }
type is a string like override or overrideAttrs
config.package = pkgs.mpv;
config.overrides = [
{
after = [ "MPV_SCRIPTS" ];
type = "override";
data = (prev: {
scripts = (prev.scripts or []) ++ [ pkgs.mpvScripts.visualizer ];
});
}
{
name = "MPV_SCRIPTS";
type = "override";
data = (prev: {
scripts = (prev.scripts or []) ++ config.scripts;
});
}
{
type = "override";
data = (prev: {
scripts = (prev.scripts or []) ++ [ pkgs.mpvScripts.autocrop ];
});
}
];
The above will add config.scripts, then pkgs.mpvScripts.visualizer and finally pkgs.mpvScripts.autocrop
Type: DAG LIST (with extra field: `type`) of (attribute set of raw value) or function that evaluates to a(n) attribute set of raw value
Default:
[ ]
Declared by:
passthru
Additional attributes to add to the resulting derivation’s passthru.
This can be used to add additional metadata or functionality to the wrapped package.
Anything added under the attribute name configuration will be ignored, as that value is used internally.
Type: attrsRecursive
Default:
{ }
Declared by:
pkgs
The nixpkgs pkgs instance to use.
Required in order to access .wrapper attribute,
either directly, or indirectly.
Type: unspecified value
Declared by:
sourceStdenv
Whether to call $stdenv/setup to set up the environment before the symlinkScript
If any phases are enabled, also runs the enabled phases after the config.symlinkScript command has ran.
NOTE: often you may prefer to use things like drv.dontFixup = true;,
or even drv.phases = [ ... "buildPhase" etc ... ]; instead,
to override this choice in a more fine-grained manner
Type: boolean
Default:
true
Declared by:
symlinkScript
Outside of importing wlib.modules.symlinkScript module,
which is included in wlib.modules.default,
This is usually an option you will never have to redefine.
This option takes a function receiving the following arguments:
module arguments + wrapper + pkgs.callPackage
{
wlib,
config,
wrapper,
... # <- anything you can get from pkgs.callPackage
}:
The function is to return a string which will be added to the buildCommand of the wrapper.
It is in charge of linking wrapper and config.outputs to the final package.
wrapper is the unchecked result of calling wrapperFunction, or null if one was not provided.
The builtin implementation, and also the wlib.modules.symlinkScript module,
accept either a string to prepend to the returned buildCommand string,
or a derivation to link with lndir
Alternatively, it may return a function.
If it returns a function, that function will be given the final computed derivation attributes,
and it will be expected to return the final attribute set to be passed to pkgs.stdenv.mkDerivation.
Regardless of if you return a string or function,
passthru.wrap, passthru.apply, passthru.eval, passthru.override,
passthru.overrideAttrs, and config.sourceStdenv will be handled for you.
Type: function that evaluates to a(n) (string or function that evaluates to a(n) attribute set of raw value)
Default:
<function, args: {config, lib, lndir, wlib, wrapper}>
Declared by:
wrap
Function to extend the current configuration with additional modules. Can accept a single module, or a list of modules. Re-evaluates the configuration with the original settings plus the new module(s).
Returns the updated package.
Type: function that evaluates to a(n) package (read only)
Default:
<function>
Declared by:
wrapper
The final wrapped package.
You may still call .eval and the rest on the package again afterwards.
Accessing this value without defining pkgs option,
either directly, or via some other means like .wrap,
will cause an error.
Type: package (read only)
Default:
<derivation hello>
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
}
The result of this function is passed DIRECTLY to the value of the symlinkScript function.
The relative path to the thing to wrap from within config.package is config.exePath
You should wrap the package and place the wrapper at "$out/bin/${config.binName}"
Type: null or (function that evaluates to a(n) raw value)
Default:
null
Declared by: