diff --git a/nixos/modules/config/system-path.nix b/nixos/modules/config/system-path.nix
index c6c20903a2c..8701b714eec 100644
--- a/nixos/modules/config/system-path.nix
+++ b/nixos/modules/config/system-path.nix
@@ -71,8 +71,16 @@ in
# to work.
default = [];
example = ["/"];
- description = "List of directories to be symlinked in `/run/current-system/sw'.";
+ description = "List of directories to be symlinked in /run/current-system/sw.";
};
+
+ outputsToLink = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ example = [ "doc" ];
+ description = "List of package outputs to be symlinked into /run/current-system/sw.";
+ };
+
};
system = {
@@ -119,7 +127,7 @@ in
system.path = pkgs.buildEnv {
name = "system-path";
paths = config.environment.systemPackages;
- inherit (config.environment) pathsToLink;
+ inherit (config.environment) pathsToLink outputsToLink;
ignoreCollisions = true;
# !!! Hacky, should modularise.
postBuild =
diff --git a/pkgs/build-support/buildenv/default.nix b/pkgs/build-support/buildenv/default.nix
index 8cbf0dc6c8e..bbfc572f55f 100644
--- a/pkgs/build-support/buildenv/default.nix
+++ b/pkgs/build-support/buildenv/default.nix
@@ -2,7 +2,7 @@
# a fork of the buildEnv in the Nix distribution. Most changes should
# eventually be merged back into the Nix distribution.
-{ perl, runCommand }:
+{ perl, runCommand, lib }:
{ name
@@ -21,6 +21,10 @@
# directories in the list is not symlinked.
pathsToLink ? ["/"]
+, # The package outputs to include. By default, only the default
+ # output is included.
+ outputsToLink ? []
+
, # Root the result in directory "$out${extraPrefix}", e.g. "/share".
extraPrefix ? ""
@@ -36,7 +40,9 @@
runCommand name
{ inherit manifest ignoreCollisions passthru pathsToLink extraPrefix postBuild buildInputs;
pkgs = builtins.toJSON (map (drv: {
- paths = [ drv ]; # FIXME: handle multiple outputs
+ paths =
+ [ drv ]
+ ++ lib.concatMap (outputName: lib.optional (drv.${outputName}.outPath or null != null) drv.${outputName}) outputsToLink;
priority = drv.meta.priority or 5;
}) paths);
preferLocalBuild = true;
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index df72eafdfcb..6956af9085f 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -261,7 +261,7 @@ let
{ substitutions = { inherit autoconf automake gettext libtool; }; }
../build-support/setup-hooks/autoreconf.sh;
- buildEnv = callPackage ../build-support/buildenv {};
+ buildEnv = callPackage ../build-support/buildenv { }; # not actually a package
buildFHSEnv = callPackage ../build-support/build-fhs-chrootenv/env.nix {
nixpkgs = pkgs;