diff --git a/doc/build-helpers/trivial-build-helpers.chapter.md b/doc/build-helpers/trivial-build-helpers.chapter.md index ff00548e049a..13b1835ee505 100644 --- a/doc/build-helpers/trivial-build-helpers.chapter.md +++ b/doc/build-helpers/trivial-build-helpers.chapter.md @@ -732,7 +732,7 @@ writeShellApplication { ## `symlinkJoin` {#trivial-builder-symlinkJoin} -This can be used to put many derivations into the same directory structure. It works by creating a new derivation and adding symlinks to each of the paths listed. It expects two arguments, `name`, and `paths`. `name` is the name used in the Nix store path for the created derivation. `paths` is a list of paths that will be symlinked. These paths can be to Nix store derivations or any other subdirectory contained within. +This can be used to put many derivations into the same directory structure. It works by creating a new derivation and adding symlinks to each of the paths listed. It expects two arguments, `name`, and `paths`. `name` (or alternatively `pname` and `version`) is the name used in the Nix store path for the created derivation. `paths` is a list of paths that will be symlinked. These paths can be to Nix store derivations or any other subdirectory contained within. Here is an example: ```nix # adds symlinks of hello and stack to current build and prints "links added" diff --git a/pkgs/build-support/trivial-builders/default.nix b/pkgs/build-support/trivial-builders/default.nix index a02fe1fd6d0a..7d68a2ae6ea8 100644 --- a/pkgs/build-support/trivial-builders/default.nix +++ b/pkgs/build-support/trivial-builders/default.nix @@ -469,7 +469,11 @@ rec { as a easy way to build multiple derivations at once. */ symlinkJoin = - args_@{ name + args_@{ + name ? + assert lib.assertMsg (args_ ? pname && args_ ? version) + "symlinkJoin requires either a `name` OR `pname` and `version`"; + "${args_.pname}-${args_.version}" , paths , preferLocalBuild ? true , allowSubstitutes ? false