(WIP) srcOnly: Add noogle-compatible documentation

This commit is contained in:
Gavin John 2024-09-28 15:43:03 -07:00
parent 1463fe69c6
commit 28ee6e7979
No known key found for this signature in database
GPG Key ID: 792E158CDD33C3EE

View File

@ -1,12 +1,39 @@
{ lib, stdenvNoCC }:
# srcOnly is a utility builder that only fetches and unpacks the given `src`,
# and optionally patching with `patches` or adding build inputs.
#
# It can be invoked directly, or be used to wrap an existing derivation. Eg:
#
# > srcOnly pkgs.hello
#
/**
A utility builder to get the source code of the input derivation, with any patches applied.
# Examples
```nix
srcOnly pkgs.hello
=> «derivation /nix/store/gyfk2jg9079ga5g5gfms5i4h0k9jhf0f-hello-2.12.1-source.drv»
srcOnly {
inherit (pkgs.hello) name version src stdenv;
}
=> «derivation /nix/store/vf9hdhz38z7rfhzhrk0vi70h755fnsw7-hello-2.12.1-source.drv»
```
# Type
```
srcOnly :: (Derivation | AttrSet) -> Derivation
```
# Input
`attrs`
: One of the following:
- A derivation with (at minimum) an unpackPhase and a patchPhase.
- A set of attributes that would be passed to a `stdenv.mkDerivation` or `stdenvNoCC.mkDerivation` call.
# Output
A derivation that runs a derivation's `unpackPhase` and `patchPhase`, and then copies the result to the output path.
*/
attrs:
let