summary refs log tree commit diff
path: root/pkgs/build-support/src-only/default.nix
blob: b4e373cd058e6ccbd7bc5f0c57fd16116f261ddd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{ 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"];
})