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

Marc Weber marco-oweber at gmx.de
Wed Sep 23 20:43:30 CEST 2009


Hi, I thought about the alsaPlugins stuff again:


dep tree:

alsaLib -> pulseaudio ->  alsaPlugins
|       -> jackaudio  ->
|
 \
   -> mplayer, firefox, skype, ..


now alsaLib has to find the .so files provided by alsaPlugins. That's
why I made it read ALSA_PLUGIN_DIRS so that I can tell alsaLib about the
alsaPlugins store path.

Now how to get the best user experience?

  a) minimal change of store paths (don't rebuild stuff)
  b) configure it once and be done

Example a)
  MPlayer can use alsa-lib as backend. So the mplayer executable should
  be wrapped

  But MPlayer is also a buildinput used by gecko_mediaplayer.
  So if we wrap MPlayer, we don't want to rebuild gecko_mediaplayer


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?



More information about the nix-dev mailing list