889482aab3
GitOrigin-RevId: f2537a505d45c31fe5d9c27ea9829b6f4c4e6ac5
19 lines
632 B
Nix
19 lines
632 B
Nix
{ 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
|
|
#
|
|
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";
|
|
installPhase = "cp -r . $out";
|
|
phases = ["unpackPhase" "patchPhase" "installPhase"];
|
|
})
|