nixpkgs/pkgs/build-support/src-only/default.nix
sternenseemann f76ac449d1 srcOnly: fix with separateDebugInfo and/or multiple outputs
Before this change `srcOnly git` gives:

    duplicate derivation output 'debug', at pkgs/stdenv/generic/make-derivation.nix:270:7

This was because separateDebugInfo = true was passed on to the srcOnly
mkDerivation as well as the outputs list _including_ the debug output.
Luckily we don't need to untangle this mess since srcOnly is only
supposed to have a single output anyways.
2022-07-02 19:32:24 +02:00

22 lines
684 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";
outputs = [ "out" ];
separateDebugInfo = false;
phases = ["unpackPhase" "patchPhase" "installPhase"];
})