diff --git a/lib/customisation.nix b/lib/customisation.nix
index 585495469b2..efe82d78660 100644
--- a/lib/customisation.nix
+++ b/lib/customisation.nix
@@ -129,7 +129,7 @@ rec {
};
outputsList = map outputToAttrListElement outputs;
- in commonAttrs.${drv.outputName};
+ in commonAttrs // { outputUnspecified = true; };
/* Strip a derivation of all non-essential attributes, returning
diff --git a/nixos/modules/config/debug-info.nix b/nixos/modules/config/debug-info.nix
index a096a9809ce..777ae71eebf 100644
--- a/nixos/modules/config/debug-info.nix
+++ b/nixos/modules/config/debug-info.nix
@@ -38,7 +38,7 @@ with lib;
# environment.pathsToLink, and we can't have both.
#environment.pathsToLink = [ "/lib/debug/.build-id" ];
- environment.outputsToLink =
+ environment.extraOutputsToLink =
optional config.environment.enableDebugInfo "debug";
};
diff --git a/nixos/modules/config/system-path.nix b/nixos/modules/config/system-path.nix
index 3df7d7cdac4..eb5eba7a042 100644
--- a/nixos/modules/config/system-path.nix
+++ b/nixos/modules/config/system-path.nix
@@ -73,11 +73,11 @@ in
description = "List of directories to be symlinked in /run/current-system/sw.";
};
- outputsToLink = mkOption {
+ extraOutputsToLink = mkOption {
type = types.listOf types.str;
default = [ ];
- example = [ "doc" ];
- description = "List of package outputs to be symlinked into /run/current-system/sw.";
+ example = [ "doc" "info" "docdev" ];
+ description = "List of additional package outputs to be symlinked into /run/current-system/sw.";
};
};
@@ -120,18 +120,17 @@ in
"/share/vim-plugins"
];
- environment.outputsToLink = [ "bin" "lib" "out" ];
-
system.path = pkgs.buildEnv {
name = "system-path";
paths =
- lib.filter (drv: drv != null && drv != (drv.dev or null))
- (lib.concatMap (drv:
- [ drv ] ++ map (outputName: drv.${outputName}.outPath or null) config.environment.outputsToLink)
- config.environment.systemPackages);
- inherit (config.environment) pathsToLink;
+ # The default output probably shouldn't be globally configurable.
+ # Services and users should specify them explicitly unless they want this default.
+ map (p: if p.outputUnspecified or false then p.bin or p.out or p else p)
+ config.environment.systemPackages;
+ inherit (config.environment) pathsToLink extraOutputsToLink;
ignoreCollisions = true;
# !!! Hacky, should modularise.
+ # outputs TODO: note that the tools will often not be linked by default
postBuild =
''
if [ -x $out/bin/update-mime-database -a -w $out/share/mime ]; then
diff --git a/nixos/modules/programs/man.nix b/nixos/modules/programs/man.nix
index b2850653804..94d026fdaef 100644
--- a/nixos/modules/programs/man.nix
+++ b/nixos/modules/programs/man.nix
@@ -23,7 +23,7 @@ with lib;
environment.pathsToLink = [ "/share/man" ];
- environment.outputsToLink = [ "man" ];
+ environment.extraOutputsToLink = [ "man" ];
};
diff --git a/nixos/modules/security/polkit.nix b/nixos/modules/security/polkit.nix
index 70e5e8b9fa7..507f81bbf07 100644
--- a/nixos/modules/security/polkit.nix
+++ b/nixos/modules/security/polkit.nix
@@ -59,7 +59,7 @@ in
config = mkIf cfg.enable {
- environment.systemPackages = [ pkgs.polkit ];
+ environment.systemPackages = [ pkgs.polkit.bin pkgs.polkit.out ];
systemd.packages = [ pkgs.polkit.out ];
diff --git a/pkgs/build-support/buildenv/default.nix b/pkgs/build-support/buildenv/default.nix
index 1a0726d1543..bcfa2dd1c5a 100644
--- a/pkgs/build-support/buildenv/default.nix
+++ b/pkgs/build-support/buildenv/default.nix
@@ -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.
+ extraOutputsToLink ? []
+
, # Root the result in directory "$out${extraPrefix}", e.g. "/share".
extraPrefix ? ""
@@ -37,7 +41,10 @@
runCommand name
rec { inherit manifest ignoreCollisions passthru meta pathsToLink extraPrefix postBuild buildInputs;
pkgs = builtins.toJSON (map (drv: {
- paths = [ drv ];
+ paths =
+ [ drv ]
+ ++ lib.filter (p: p!=null)
+ (builtins.map (outName: drv.${outName} or null) extraOutputsToLink);
priority = drv.meta.priority or 5;
}) paths);
preferLocalBuild = true;