nixos/documentation: Correct use of lib.optional

lib.optional returns a singleton or an empty list. Therefore the
argument does not need to be wrapped in a list.
An alternative patch could have used lib.optionals but seems like no
more elements are going to be added to the optional list.
This commit is contained in:
Daniel Schaefer 2018-05-05 15:41:28 +07:00
parent 34a71a80b8
commit 43650115e3

View File

@ -75,20 +75,20 @@ let cfg = config.documentation; in
(mkIf cfg.man.enable { (mkIf cfg.man.enable {
environment.systemPackages = [ pkgs.man-db ]; environment.systemPackages = [ pkgs.man-db ];
environment.pathsToLink = [ "/share/man" ]; environment.pathsToLink = [ "/share/man" ];
environment.extraOutputsToInstall = [ "man" ] ++ optional cfg.dev.enable [ "devman" ]; environment.extraOutputsToInstall = [ "man" ] ++ optional cfg.dev.enable "devman";
}) })
(mkIf cfg.info.enable { (mkIf cfg.info.enable {
environment.systemPackages = [ pkgs.texinfoInteractive ]; environment.systemPackages = [ pkgs.texinfoInteractive ];
environment.pathsToLink = [ "/share/info" ]; environment.pathsToLink = [ "/share/info" ];
environment.extraOutputsToInstall = [ "info" ] ++ optional cfg.dev.enable [ "devinfo" ]; environment.extraOutputsToInstall = [ "info" ] ++ optional cfg.dev.enable "devinfo";
}) })
(mkIf cfg.doc.enable { (mkIf cfg.doc.enable {
# TODO(@oxij): put it here and remove from profiles? # TODO(@oxij): put it here and remove from profiles?
# environment.systemPackages = [ pkgs.w3m ]; # w3m-nox? # environment.systemPackages = [ pkgs.w3m ]; # w3m-nox?
environment.pathsToLink = [ "/share/doc" ]; environment.pathsToLink = [ "/share/doc" ];
environment.extraOutputsToInstall = [ "doc" ] ++ optional cfg.dev.enable [ "devdoc" ]; environment.extraOutputsToInstall = [ "doc" ] ++ optional cfg.dev.enable "devdoc";
}) })
]); ]);