trivial: make symlinkJoin support pname+version alone

This commit is contained in:
Peder Bergebakken Sundt 2024-09-26 14:52:50 +02:00
parent e1635a35b9
commit 6fd3990534
2 changed files with 6 additions and 2 deletions

View File

@ -732,7 +732,7 @@ writeShellApplication {
## `symlinkJoin` {#trivial-builder-symlinkJoin} ## `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: Here is an example:
```nix ```nix
# adds symlinks of hello and stack to current build and prints "links added" # adds symlinks of hello and stack to current build and prints "links added"

View File

@ -469,7 +469,11 @@ rec {
as a easy way to build multiple derivations at once. as a easy way to build multiple derivations at once.
*/ */
symlinkJoin = 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 , paths
, preferLocalBuild ? true , preferLocalBuild ? true
, allowSubstitutes ? false , allowSubstitutes ? false