addContextFrom
lib.strings.addContextFrom
Docs pulled from | This Revision | 44 minutes ago
Appends string context from string like object src to target.
This is an implementation detail of Nix and should be used carefully.
Strings in Nix carry an invisible context which is a list of strings
representing store paths. If the string is later used in a derivation
attribute, the derivation will properly populate the inputDrvs and
inputSrcs.
Inputs
src- The string to take the context from. If the argument is not a string, it will be implicitly converted to a string.
target- The string to append the context to. If the argument is not a string, it will be implicitly converted to a string.
Type
addContextFrom :: string -> string -> string
Examples
lib.strings.addContextFrom usage example
pkgs = import <nixpkgs> { };
addContextFrom pkgs.coreutils "bar"
=> "bar"
The context can be displayed using the toString function:
nix-repl> builtins.getContext (lib.strings.addContextFrom pkgs.coreutils "bar")
{
"/nix/store/m1s1d2dk2dqqlw3j90jl3cjy2cykbdxz-coreutils-9.5.drv" = { ... };
}
Noogle detected
Implementation
The following is the current implementation of this function.
addContextFrom = src: target: substring 0 0 src + target;