git.iko.soy/typeable/nixpkgs
on master help sign in
Add option to link additional package outputs into system.path

This is necessary to get stuff like separate manpages, info files, debug symbols, etc.

commit58e9440b8983c2e0dbab667dc7944e8af9955a35 authorEelco Dolstra <eelco.dolstra@logicblox.com> dateFri 30 Oct 2015, 14:13 (11 years ago) parent3e732f6
3 files changed+19−5
nixos/modules/config/system-path.nix+10−2 pkgs/build-support/buildenv/default.nix+8−2 pkgs/top-level/all-packages.nix+1−1
nixos/modules/config/system-path.nix+10−2
@@ -71,8 +71,16 @@ in
7171 # to work.
7272 default = [];
7373 example = ["/"];
74− description = "List of directories to be symlinked in `/run/current-system/sw'.";
74+ description = "List of directories to be symlinked in <filename>/run/current-system/sw</filename>.";
7575 };
76+
77+ outputsToLink = mkOption {
78+ type = types.listOf types.str;
79+ default = [];
80+ example = [ "doc" ];
81+ description = "List of package outputs to be symlinked into <filename>/run/current-system/sw</filename>.";
82+ };
83+
7684 };
7785
7886 system = {
@@ -119,7 +127,7 @@ in
119127 system.path = pkgs.buildEnv {
120128 name = "system-path";
121129 paths = config.environment.systemPackages;
122− inherit (config.environment) pathsToLink;
130+ inherit (config.environment) pathsToLink outputsToLink;
123131 ignoreCollisions = true;
124132 # !!! Hacky, should modularise.
125133 postBuild =
pkgs/build-support/buildenv/default.nix+8−2
@@ -2,7 +2,7 @@
22# a fork of the buildEnv in the Nix distribution. Most changes should
33# eventually be merged back into the Nix distribution.
44
5−{ perl, runCommand }:
5+{ perl, runCommand, lib }:
66
77{ name
88
@@ -21,6 +21,10 @@
2121 # directories in the list is not symlinked.
2222 pathsToLink ? ["/"]
2323
24+, # The package outputs to include. By default, only the default
25+ # output is included.
26+ outputsToLink ? []
27+
2428, # Root the result in directory "$out${extraPrefix}", e.g. "/share".
2529 extraPrefix ? ""
2630
@@ -36,7 +40,9 @@
3640runCommand name
3741 { inherit manifest ignoreCollisions passthru pathsToLink extraPrefix postBuild buildInputs;
3842 pkgs = builtins.toJSON (map (drv: {
39− paths = [ drv ]; # FIXME: handle multiple outputs
43+ paths =
44+ [ drv ]
45+ ++ lib.concatMap (outputName: lib.optional (drv.${outputName}.outPath or null != null) drv.${outputName}) outputsToLink;
4046 priority = drv.meta.priority or 5;
4147 }) paths);
4248 preferLocalBuild = true;
pkgs/top-level/all-packages.nix+1−1
@@ -261,7 +261,7 @@ let
261261 { substitutions = { inherit autoconf automake gettext libtool; }; }
262262 ../build-support/setup-hooks/autoreconf.sh;
263263
264− buildEnv = callPackage ../build-support/buildenv {};
264+ buildEnv = callPackage ../build-support/buildenv { }; # not actually a package
265265
266266 buildFHSEnv = callPackage ../build-support/build-fhs-chrootenv/env.nix {
267267 nixpkgs = pkgs;