Fix system-path with multiout

This commit is contained in:
Luca Bruno 2015-11-27 14:49:54 +01:00
parent 920b1d3591
commit 31ed92f65f
3 changed files with 11 additions and 19 deletions

View file

@ -75,7 +75,7 @@ in
outputsToLink = mkOption { outputsToLink = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = []; default = [ ];
example = [ "doc" ]; example = [ "doc" ];
description = "List of package outputs to be symlinked into <filename>/run/current-system/sw</filename>."; description = "List of package outputs to be symlinked into <filename>/run/current-system/sw</filename>.";
}; };
@ -120,18 +120,16 @@ in
"/share/vim-plugins" "/share/vim-plugins"
]; ];
environment.outputsToLink = [ "bin" "lib" "out" ];
system.path = pkgs.buildEnv { system.path = pkgs.buildEnv {
name = "system-path"; name = "system-path";
paths = let paths =
inherit (config.environment) pathsToLink outputsToLink; lib.filter (drv: drv != null && drv != (drv.dev or null))
#outputs TODO: some code already merged by Eelco? make it user-customizable? (lib.concatMap (drv:
pkgOutputFun = pkg: lib.filter (p: p!=null) [ [ drv ] ++ map (outputName: drv.${outputName}.outPath or null) config.environment.outputsToLink)
(pkg.bin or (pkg.out or pkg)) config.environment.systemPackages);
(pkg.man or null) inherit (config.environment) pathsToLink;
(pkg.info or null)
(pkg.doc or null)
];
in lib.concatMap pkgOutputFun config.environment.systemPackages;
ignoreCollisions = true; ignoreCollisions = true;
# !!! Hacky, should modularise. # !!! Hacky, should modularise.
postBuild = postBuild =

View file

@ -59,7 +59,7 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.polkit.bin pkgs.polkit.out ]; environment.systemPackages = [ pkgs.polkit ];
systemd.packages = [ pkgs.polkit.out ]; systemd.packages = [ pkgs.polkit.out ];

View file

@ -21,10 +21,6 @@
# directories in the list is not symlinked. # directories in the list is not symlinked.
pathsToLink ? ["/"] 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". , # Root the result in directory "$out${extraPrefix}", e.g. "/share".
extraPrefix ? "" extraPrefix ? ""
@ -40,9 +36,7 @@
runCommand name runCommand name
rec { inherit manifest ignoreCollisions passthru pathsToLink extraPrefix postBuild buildInputs; rec { inherit manifest ignoreCollisions passthru pathsToLink extraPrefix postBuild buildInputs;
pkgs = builtins.toJSON (map (drv: { pkgs = builtins.toJSON (map (drv: {
paths = paths = [ drv ];
[ drv ]
++ lib.concatMap (outputName: lib.optional (drv.${outputName}.outPath or null != null) drv.${outputName}) outputsToLink;
priority = drv.meta.priority or 5; priority = drv.meta.priority or 5;
}) paths); }) paths);
preferLocalBuild = true; preferLocalBuild = true;