Unverified Commit eee954a4 authored by Philip Taron's avatar Philip Taron Committed by GitHub
Browse files

trivial: make symlinkJoin support pname+version alone (#344645)

parents db44da13 0eb7e098
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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"
+5 −1
Original line number Diff line number Diff line
@@ -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
+1 −2
Original line number Diff line number Diff line
@@ -10,10 +10,9 @@
  disableUpdateNotifier ? true,
}:

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

  nativeBuildInputs = [ makeBinaryWrapper ];