2024-05-02 00:46:19 +00:00
|
|
|
{ stdenv }:
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
attrs:
|
|
|
|
let
|
|
|
|
args = if builtins.hasAttr "drvAttrs" attrs then attrs.drvAttrs else attrs;
|
2024-05-13 21:24:10 +00:00
|
|
|
name = if builtins.hasAttr "name" args then
|
|
|
|
args.name
|
|
|
|
else
|
|
|
|
"${args.pname}-${args.version}";
|
|
|
|
in stdenv.mkDerivation (args // {
|
2024-05-02 00:46:19 +00:00
|
|
|
name = "${name}-source";
|
|
|
|
installPhase = "cp -r . $out";
|
|
|
|
outputs = [ "out" ];
|
|
|
|
separateDebugInfo = false;
|
|
|
|
dontUnpack = false;
|
|
|
|
dontInstall = false;
|
2024-05-13 21:24:10 +00:00
|
|
|
phases = [ "unpackPhase" "patchPhase" "installPhase" ];
|
2024-05-02 00:46:19 +00:00
|
|
|
})
|