getFirstOutput
lib.attrsets.getFirstOutput
Docs pulled from | This Revision | 10 minutes ago
Get the first of the outputs
provided by the package, or the default.
This function is alligned with _overrideFirst()
from the multiple-outputs.sh
setup hook.
Like getOutput
, the function is idempotent.
Inputs
outputs
-
1. Function argument
pkg
-
2. Function argument
Type
getFirstOutput :: [String] -> Derivation -> Derivation
Examples
lib.attrsets.getFirstOutput
usage example
"${getFirstOutput [ "include" "dev" ] pkgs.openssl}"
=> "/nix/store/00000000000000000000000000000000-openssl-1.0.1r-dev"
Noogle detected
Implementation
The following is the current implementation of this function.
getFirstOutput =
candidates: pkg:
let
outputs = builtins.filter (name: hasAttr name pkg) candidates;
output = builtins.head outputs;
in
if pkg.outputSpecified or false || outputs == [ ] then pkg else pkg.${output};