summary refs log tree commit diff
diff options
context:
space:
mode:
authorzimbatm <zimbatm@zimbatm.com>2020-04-22 09:48:05 +0200
committerzimbatm <zimbatm@zimbatm.com>2020-04-22 14:06:28 +0200
commitbbbc41918634c2388f1fd39db1c8f162e3ab4b95 (patch)
treee546e1a099c7e89ed4cb6ca15c3b579e57c353b4
parent539fb74a5b43f87d78be730b41e634e19ae1e7a2 (diff)
downloadnixpkgs-bbbc41918634c2388f1fd39db1c8f162e3ab4b95.tar
nixpkgs-bbbc41918634c2388f1fd39db1c8f162e3ab4b95.tar.gz
nixpkgs-bbbc41918634c2388f1fd39db1c8f162e3ab4b95.tar.bz2
nixpkgs-bbbc41918634c2388f1fd39db1c8f162e3ab4b95.tar.lz
nixpkgs-bbbc41918634c2388f1fd39db1c8f162e3ab4b95.tar.xz
nixpkgs-bbbc41918634c2388f1fd39db1c8f162e3ab4b95.tar.zst
nixpkgs-bbbc41918634c2388f1fd39db1c8f162e3ab4b95.zip
srcOnly: fix invocation and document
Previously, callPackage would try and fill the arguments such as `name`
and `src` which would cause problems if those existed as top-level
attributes. This also makes it clearer what part is the function
signature.

Then document the derivation inline in the code to explain the ellipsis
and various use-cases.
-rw-r--r--pkgs/build-support/src-only/default.nix17
-rw-r--r--pkgs/top-level/all-packages.nix2
2 files changed, 17 insertions, 2 deletions
diff --git a/pkgs/build-support/src-only/default.nix b/pkgs/build-support/src-only/default.nix
index a93b3648090..8ca262a998b 100644
--- a/pkgs/build-support/src-only/default.nix
+++ b/pkgs/build-support/src-only/default.nix
@@ -1,4 +1,19 @@
-{stdenv, name, src, patches ? [], buildInputs ? [], ...}: 
+{ 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
+#
+{ name
+, src
+, stdenv ? orig.stdenv
+, patches ? []
+, buildInputs ? []
+, ... # needed when passing an existing derivation
+}:
 stdenv.mkDerivation {
   inherit src buildInputs patches name;
   installPhase = "cp -r . $out";
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index febca841867..7e61b010316 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -450,7 +450,7 @@ in
 
   singularity-tools = callPackage ../build-support/singularity-tools { };
 
-  srcOnly = args: callPackage ../build-support/src-only args;
+  srcOnly = callPackage ../build-support/src-only { };
 
   substituteAll = callPackage ../build-support/substitute/substitute-all.nix { };