3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/build-support/src-only/default.nix
sternenseemann c98cda29f7 srcOnly: prevent phases being skipped
Previously srcOnly would not work for e.g.
`srcOnly haskell.compiler.ghcjs`, as the custom `installPhase` would be
skipped if `dontInstall` is set. Consequently, we need to ensure that
the two skippable phases we need will always be executed.
2023-01-06 19:02:50 +01:00

24 lines
724 B
Nix

{ stdenv }:
# 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;
dontUnpack = false;
dontInstall = false;
phases = ["unpackPhase" "patchPhase" "installPhase"];
})