Skip to content

Commit

Permalink
trivial: make symlinkJoin support pname+version alone (NixOS#344645)
Browse files Browse the repository at this point in the history
  • Loading branch information
philiptaron authored Oct 23, 2024
2 parents db44da1 + 0eb7e09 commit eee954a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doc/build-helpers/trivial-build-helpers.chapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion pkgs/build-support/trivial-builders/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions pkgs/by-name/tu/turbo/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
disableUpdateNotifier ? true,
}:

symlinkJoin rec {
symlinkJoin {
pname = "turbo";
inherit (turbo-unwrapped) version;
name = "${pname}-${version}";

nativeBuildInputs = [ makeBinaryWrapper ];

Expand Down

0 comments on commit eee954a

Please sign in to comment.