[Nix-dev] Separating free and non-free packages, again

Marc Weber marco-oweber at gmx.de
Sat Nov 21 13:49:34 CET 2009


Hi Tony,

you missed a small detail.

Let's have a look at a complete example how it could look like:

=== free/all-packages.nix: ====

  setup@{ 
      system ? builtins.currentSystem
    , stdenvType ? system
    , bootStdenv ? null
    , noSysDirs ? true
    , gccWithCC ? true
    , gccWithProfiling ? true
    ,  config ? null
  }:

  let overlay = name: if builtins.pathExists "../${name}" then
        (import ../python-packgaes/all-packages.nix) setup;
      else {};

      requireOverlayPackage = path: overlays:
        let r =  attrByPath list overlays null;
        if r == null then throw "missing packages ${path}, get the the missing overlay, please!"
        else r;
  in

  # simplified:
  let pkgs = {

    overlays = {
      nonFree = overlay "non-free";
      ovorlayPythonPackages = overlay "python";
      ovorlayHaskellPackgaes = overlay "haskell";
      ovorlayMyPrivatePackages = overlay "mine";
      // you can add more using packageOverrides or we can find a
      // different way!
    };

    /* the other overlays of course have this to refer to the free packages:
    free = (import ../free/all-packages.nix) setup;
    */

    audacity = stdenv.mkDerivation {
      inherit audioLib gcc ...;
      # if the non-free overlay is there pass the package else pass null
      nonFreePackage = attrByPath ["nonFree" "nonFreePackage"] overlays null;
      nonFreePackage = requireOverlayPackage ["nonFree" "nonFreePackage"] overlays;
    };

  }; in pkgs;

== end ==

And of course packages can referer to packages defined in other overlays
multiple times.

Of course this is only a draft and not a final implementation.

Tony, do you get/like the idea now?
Do you think this really adds that much overhead?

The benefits are:
You can remove the non-free repository and be done.
You won't get it back by svn update.
You can add different experimental overlays for things which change to
fast so that they should not be included into the main repo (yet).

drawbacks:
You have to synchronize multiple repositories. But I think we can live
with that.

This solution will scale. Each small company can add its own overlay
with internal packages etc.

Maybe we can even look at nixos being an overlay only then.

Thoughts?
Marc Weber



More information about the nix-dev mailing list