[Nix-dev] difference build input and installable package ?

Nicolas Pierron nicolas.b.pierron at gmail.com
Wed Sep 23 21:12:46 CEST 2009


On Wed, Sep 23, 2009 at 20:43, Marc Weber <marco-oweber at gmx.de> wrote:
> Solution: attach some information to each package which might be
> installed by the user telling that this derivation should be wrapped by
> exporting ALSA_PLUGIN_DIRS. How could this be done?
>
>
> alsaLib = stdenv.mkDerivation {
>  name = "foo";
>  passthru = if getConfig "useAlsaLib" then
>                 { addEnv = { ALSA_PLUGIN_DIRS = "$alsaPlugins/lib-alsa" }; }
>            else {};
> }
>
> options;
> let pkgs = import (.../all-packages.nix) options;
>    postProcessPackage = pkg:
>      if pkg_or_any_dep ? addEnv then
>        newDerivationWrappedExecutables pkg
>      else pkg;
> in mapAttrs postProcessPackage  pkgs;
>
> Does this sound sound?
> This means : only the final packages will be wrapped if you set the
> configuration option.
>
> So if you install MPlayer and gecko_mediaplayer
> the unwrapped MPlayer will be passed to gecko_mediaplayer while
> MPlayer and gecko_mediaplayer being installed to your env will be
> wrapped.
>
> How do you like this?
> Any better idea to implement this?

I like this idea but it is not general enough to me.

I've suggested, some time ago to factor post-processes of packages
depending on theirs tags, The idea was to use some "specificBuildEnv"s
to build the user environment from the whole list of packages and,
then get rid of special derivations like the one used to glue all TeX
packages, Ruby, Python, and so on ...

Indeed, populating the wrapper in a bottom-up fashion is very nice
because this means less hand writing, but getConfig means that you
have to warn the user about the flag.  You want an answer of this
question: "Is there any alsa-plugin installed?".  Then if you detect
one (in the user environment, or system environment) you need to do a
top-down traversal of the dependencies followed by a bottom-up
traversal to spread the information to the Mplayer tool.

-- 
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron
Donald Knuth - I can't go to a restaurant because I keep looking at
the fonts on the menu.



More information about the nix-dev mailing list