srcOnly
pkgs.srcOnly
Functor
Docs pulled from | This Revision | 10 minutes ago
A utility builder to get the source code of the input derivation, with any patches applied.
Examples
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
orstdenvNoCC.mkDerivation
call.
Output
A derivation that runs a derivation's unpackPhase
and patchPhase
, and then copies the result to the output path.
Noogle detected
This is a Functor
Learn about functors
Implementation
The following is the current implementation of this function.
attrs:
let
args = attrs.drvAttrs or attrs;
name = args.name or "${args.pname}-${args.version}";
stdenv = args.stdenv or (lib.warn "srcOnly: stdenv not provided, using stdenvNoCC" stdenvNoCC);
drv = stdenv.mkDerivation (
args
// {
name = "${name}-source";
outputs = [ "out" ];
phases = [
"unpackPhase"
"patchPhase"
"installPhase"
];
separateDebugInfo = false;
dontUnpack = false;
dontInstall = false;
installPhase = "cp -pr --reflink=auto -- . $out";
}
);
in
lib.warnIf (args.dontUnpack or false) "srcOnly: derivation has dontUnpack set, overriding" drv