[Nix-dev] Re: [Nix-commits] SVN commit: nix - 21101 - urkud - nixos/trunk/modules/config

Nicolas Pierron nicolas.b.pierron at gmail.com
Thu Apr 15 19:44:29 CEST 2010


Hi Yury,

On Thu, Apr 15, 2010 at 17:46, Yury G Kudryashov <urkud at mccme.ru> wrote:
> Allow additions to pathsToLink
>
> Changes:
>
> Modified: nixos/trunk/modules/config/system-path.nix
> ===================================================================
> --- nixos/trunk/modules/config/system-path.nix  2010-04-15 15:46:47 UTC (rev 21100)
> +++ nixos/trunk/modules/config/system-path.nix  2010-04-15 15:46:55 UTC (rev 21101)
> @@ -77,13 +77,23 @@
>       };
>
>       pathsToLink = mkOption {
> +        # Note: We need `/lib' to be among `pathsToLink' for NSS modules
> +        # to work.
>         default = ["/bin" "/sbin" "/lib" "/share/man" "/share/info" "/man" "/info"];
>         example = ["/"];
>         description = "
>           Lists directories to be symlinked in `/var/run/current-system/sw'.
> +          Use extraLinkPaths if you want just to add some additional paths.
>         ";
>       };
>
> +      extraLinkPaths = mkOption {
> +          default = [];
> +          example = ["/"];
> +          description = "
> +            Extra directories to be symlinked in /var/run/current-system/sw.
> +          ";
> +      };
>     };

We don't need extra* options anymore because:
- This add an additional option to process and slow down NixOS evaluation.
- This is already expressed by the merge function.
- Default definition can be defined and extended.

>     system = {
> @@ -97,9 +107,7 @@
>           name = "system-path";
>           paths = list;
>
> -          # Note: We need `/lib' to be among `pathsToLink' for NSS modules
> -          # to work.
> -          inherit (config.environment) pathsToLink;
> +          pathsToLink = with config.environment; pathsToLink ++ extraLinkPaths;
>
>           ignoreCollisions = true;
>         };

inside a config attribute you should define
  pathsToLink = mkDefaultValue ["/bin" "/sbin" "/lib" "/share/man"
"/share/info" "/man" "/info"];

in your KDE expression you should extend it by adding the same
property, otherwise you will get a higher priority and you will mask
the default value defined as a definition.
  KDEpaths = mkDefaultValue ["/wtf"];

If the user want to link other path, he can do so by doing:
  pathsToLink = ["/bin" "/sbin" "/lib" "/share/man" "/man"];

In the case of pathsToLink, this could be debated to whatever we want
to add a lower priority to it or just drop the mkDefaultValue.

-- 
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron - http://nbp.name/



More information about the nix-dev mailing list