[Nix-dev] Re: Separating Free/non-free package

Ludovic Courtès ludo at gnu.org
Mon Sep 21 16:54:06 CEST 2009


Hi!

Michael Raskin <7c6f434c at mail.ru> writes:

> 2) for every verified package, put the following in the licenses.txt:
>   packageName = {
>     fourFreedoms = true; /* or false */
>   }

Here’s a first prototype for ‘licenses.nix’:

--8<---------------cut here---------------start------------->8---
let
  pkgs = (import ./all-packages.nix) {};

  reviewed = attrName: version: license: free:
    let pkg = builtins.getAttr attrName pkgs;
        fullName = "${attrName}-${version}";
    in
      if (fullName == pkg.name
          && pkg ? meta
          && pkg.meta ? license
          && license == pkg.meta.license)
      then ({ name = attrName;
              value = (pkg // { meta.free = free; }); })
      else {};

  reviewedPackageList = [
    (reviewed "guile" "1.8.7" "LGPLv2+" true)
    (reviewed "libunistring" "0.9.1.1" "LGPLv3+" true)
    (reviewed "flashplayer" "10.0.32.18" "non-free" false)
  ];

  reviewedPackages = builtins.listToAttrs
    (pkgs.lib.lists.filter (p: p ? name) reviewedPackageList);

  freePackages = builtins.listToAttrs
    (pkgs.lib.lists.filter (p: if p ? value
                               then p.value.meta.free
                               else false)
                           reviewedPackageList);

in
 { inherit reviewedPackages freePackages; }
--8<---------------cut here---------------end--------------->8---

The ‘reviewed’ bit concerns both the ‘license’ and ‘free’ tags.

It tells the exact version that was audited, so that packages
automatically leave ‘reviewedPackages’ when updated but not
“re-reviewed”, as Nicolas suggested.

The obvious drawback is that it’ll need to be updated very often.
Perhaps we could instead allow for version patterns (e.g., “1.8.*”)
instead of exact versions.

Comments?

Thanks,
Ludo’.




More information about the nix-dev mailing list