Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

wlib.modules.constructFiles

modules/constructFiles

This module is made possible by: birdee

Adds a constructFiles option that allows for easier creation of generated files in which placeholders such as ${placeholder "out"} work

From inside the module, you can

config.constructFiles.<name> = {
  content = "some file content";
  relPath = "some/path";
};
# you can get the resulting placeholder path with config.constructFiles.<name>.path

It also provides a read-only config value that allows the placeholder file location to be easily accessible outside of the derivation.

In addition, on the resulting package, all the values in config are accessible via passthru.configuration

This means you can yourWrappedPackage.configuration.constructFiles.<name>.outPath to get the final path to it from outside of the wrapper module, without having to worry about making sure placeholders resolve correctly yourself.

Note, that will not work inside the module. Inside the module, you will want to use config.constructFiles.<name>.path.

Also note that attribute sets with .outPath in them can be directly interpolated.

Outside the module, you can also get the path with "${yourWrappedPackage.configuration.constructFiles.<name>}"

Imported by wlib.modules.default


constructFiles

An option for creating files with content of arbitrary length in the final wrapper derivation, in which the nix placeholders like ${placeholder "out"} can be used

Type: attribute set of (submodule)

Default:

{ }

Declared by:

constructFiles.<name>.builder

the command used to build the file.

Will be placed inside a bash function, with $1 as the input file and $2 as the output file

Type: string

Default:

"mkdir -p \"$(dirname \"$2\")\" && cp \"$1\" \"$2\""

Declared by:

constructFiles.<name>.content

The content for the file to be added to the final derivation

Type: strings concatenated with “\n”

Default:

""

Declared by:

constructFiles.<name>.key

The attribute to add the file contents to on the final derivation

Type: non-empty line

Default:

"‹name›"

Declared by:

constructFiles.<name>.outPath

The path to the output file available from outside of the wrapper module

Type: (read-only) string

Declared by:

constructFiles.<name>.output

The output the generated file will be created in.

Type: non-empty line

Default:

"out"

Declared by:

constructFiles.<name>.path

The path to the output file available from inside of the wrapper module

Type: (read-only) string

Declared by:

constructFiles.<name>.relPath

relative output path within the named output to create the file (no leading slash)

Type: string

Declared by: