lib: reflect effective signatures of getOutput functions

This commit is contained in:
Someone Serge 2024-07-20 19:54:07 +00:00
parent 744305bce4
commit 76db6ba81a

View File

@ -1764,6 +1764,7 @@ rec {
/** /**
Get a package output. Get a package output.
If no output is found, fallback to `.out` and then to the default. If no output is found, fallback to `.out` and then to the default.
The function is idempotent: `getOutput "b" (getOutput "a" p) == getOutput "a" p`.
# Inputs # Inputs
@ -1779,7 +1780,7 @@ rec {
# Type # Type
``` ```
getOutput :: String -> Derivation -> String getOutput :: String -> :: Derivation -> Derivation
``` ```
# Examples # Examples
@ -1787,7 +1788,7 @@ rec {
## `lib.attrsets.getOutput` usage example ## `lib.attrsets.getOutput` usage example
```nix ```nix
getOutput "dev" pkgs.openssl "${getOutput "dev" pkgs.openssl}"
=> "/nix/store/9rz8gxhzf8sw4kf2j2f1grr49w8zx5vj-openssl-1.0.1r-dev" => "/nix/store/9rz8gxhzf8sw4kf2j2f1grr49w8zx5vj-openssl-1.0.1r-dev"
``` ```
@ -1799,8 +1800,9 @@ rec {
else pkg; else pkg;
/** /**
Like `getOutput` but with a list of fallback output names. 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. This function is alligned with `_overrideFirst()` from the `multiple-outputs.sh` setup hook.
Like `getOutput`, the function is idempotent.
# Inputs # Inputs
@ -1815,7 +1817,7 @@ rec {
# Type # Type
``` ```
getFirstOutput :: [String] -> Derivation -> String getFirstOutput :: [String] -> Derivation -> Derivation
``` ```
# Examples # Examples
@ -1823,7 +1825,7 @@ rec {
## `lib.attrsets.getFirstOutput` usage example ## `lib.attrsets.getFirstOutput` usage example
```nix ```nix
getFirstOutput [ "include" "dev" ] pkgs.openssl "${getFirstOutput [ "include" "dev" ] pkgs.openssl}"
=> "/nix/store/00000000000000000000000000000000-openssl-1.0.1r-dev" => "/nix/store/00000000000000000000000000000000-openssl-1.0.1r-dev"
``` ```
@ -1853,7 +1855,7 @@ rec {
# Type # Type
``` ```
getBin :: Derivation -> String getBin :: Derivation -> Derivation
``` ```
# Examples # Examples
@ -1861,7 +1863,7 @@ rec {
## `lib.attrsets.getBin` usage example ## `lib.attrsets.getBin` usage example
```nix ```nix
getBin pkgs.openssl "${getBin pkgs.openssl}"
=> "/nix/store/00000000000000000000000000000000-openssl-1.0.1r" => "/nix/store/00000000000000000000000000000000-openssl-1.0.1r"
``` ```
@ -1883,7 +1885,7 @@ rec {
# Type # Type
``` ```
getLib :: Derivation -> String getLib :: Derivation -> Derivation
``` ```
# Examples # Examples
@ -1891,7 +1893,7 @@ rec {
## `lib.attrsets.getLib` usage example ## `lib.attrsets.getLib` usage example
```nix ```nix
getLib pkgs.openssl "${getLib pkgs.openssl}"
=> "/nix/store/9rz8gxhzf8sw4kf2j2f1grr49w8zx5vj-openssl-1.0.1r-lib" => "/nix/store/9rz8gxhzf8sw4kf2j2f1grr49w8zx5vj-openssl-1.0.1r-lib"
``` ```
@ -1913,7 +1915,7 @@ rec {
# Type # Type
``` ```
getDev :: Derivation -> String getDev :: Derivation -> Derivation
``` ```
# Examples # Examples
@ -1921,7 +1923,7 @@ rec {
## `lib.attrsets.getDev` usage example ## `lib.attrsets.getDev` usage example
```nix ```nix
getDev pkgs.openssl "${getDev pkgs.openssl}"
=> "/nix/store/9rz8gxhzf8sw4kf2j2f1grr49w8zx5vj-openssl-1.0.1r-dev" => "/nix/store/9rz8gxhzf8sw4kf2j2f1grr49w8zx5vj-openssl-1.0.1r-dev"
``` ```
@ -1942,7 +1944,7 @@ rec {
# Type # Type
``` ```
getInclude :: Derivation -> String getInclude :: Derivation -> Derivation
``` ```
# Examples # Examples
@ -1950,7 +1952,7 @@ rec {
## `lib.attrsets.getInclude` usage example ## `lib.attrsets.getInclude` usage example
```nix ```nix
getInclude pkgs.openssl "${getInclude pkgs.openssl}"
=> "/nix/store/00000000000000000000000000000000-openssl-1.0.1r-dev" => "/nix/store/00000000000000000000000000000000-openssl-1.0.1r-dev"
``` ```
@ -1972,7 +1974,7 @@ rec {
# Type # Type
``` ```
getMan :: Derivation -> String getMan :: Derivation -> Derivation
``` ```
# Examples # Examples
@ -1980,7 +1982,7 @@ rec {
## `lib.attrsets.getMan` usage example ## `lib.attrsets.getMan` usage example
```nix ```nix
getMan pkgs.openssl "${getMan pkgs.openssl}"
=> "/nix/store/9rz8gxhzf8sw4kf2j2f1grr49w8zx5vj-openssl-1.0.1r-man" => "/nix/store/9rz8gxhzf8sw4kf2j2f1grr49w8zx5vj-openssl-1.0.1r-man"
``` ```
@ -2000,7 +2002,7 @@ rec {
# Type # Type
``` ```
chooseDevOutputs :: [Derivation] -> [String] chooseDevOutputs :: [Derivation] -> [Derivation]
``` ```
*/ */
chooseDevOutputs = builtins.map getDev; chooseDevOutputs = builtins.map getDev;