2020-05-03 17:38:23 +00:00
|
|
|
{ stdenv }@orig:
|
|
|
|
# srcOnly is a utility builder that only fetches and unpacks the given `src`,
|
|
|
|
# maybe pathings it in the process with the optional `patches` and
|
|
|
|
# `buildInputs` attributes.
|
|
|
|
#
|
|
|
|
# It can be invoked directly, or be used to wrap an existing derivation. Eg:
|
|
|
|
#
|
|
|
|
# > srcOnly pkgs.hello
|
|
|
|
#
|
2022-06-26 10:26:21 +00:00
|
|
|
attrs:
|
|
|
|
let
|
|
|
|
args = if builtins.hasAttr "drvAttrs" attrs then attrs.drvAttrs else attrs;
|
|
|
|
name = if builtins.hasAttr "name" args then args.name else "${args.pname}-${args.version}";
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation (args // {
|
|
|
|
name = "${name}-source";
|
2020-04-24 23:36:52 +00:00
|
|
|
installPhase = "cp -r . $out";
|
|
|
|
phases = ["unpackPhase" "patchPhase" "installPhase"];
|
2022-06-26 10:26:21 +00:00
|
|
|
})
|