Skip to content

Commit

Permalink
srcOnly: make the -source suffix optional
Browse files Browse the repository at this point in the history
  • Loading branch information
thecaralice committed Aug 11, 2024
1 parent 0039426 commit 3eb7bac
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions pkgs/build-support/src-only/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,27 @@
#
# > srcOnly pkgs.hello
#
attrs:
{
noSuffix ? false,
...
}@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}";
args = if attrs ? drvAttrs then attrs.drvAttrs else attrs;
name = if args ? name then args.name else "${args.pname}-${args.version}";
in
stdenv.mkDerivation (args // {
name = "${name}-source";
installPhase = "cp -pr --reflink=auto -- . $out";
outputs = [ "out" ];
separateDebugInfo = false;
dontUnpack = false;
dontInstall = false;
phases = ["unpackPhase" "patchPhase" "installPhase"];
})
stdenv.mkDerivation (
args
// {
name = if noSuffix then name else "${name}-source";
installPhase = "cp -pr --reflink=auto -- . $out";
outputs = [ "out" ];
separateDebugInfo = false;
dontUnpack = false;
dontInstall = false;
phases = [
"unpackPhase"
"patchPhase"
"installPhase"
];
}
)

0 comments on commit 3eb7bac

Please sign in to comment.