Skip to content

licenses.sspl cannot be used in allowlistedLicenses/blocklistedLicenses or shortName should link to lib.licenses atrrset #154031

@ony

Description

@ony

Describe the bug

Looks like blocklistedLicenses/allowlistedLicenses require referenced licenses shortName to match attribute name of lib.licenses.
This is broken for SSPL license and for some packages that have inline license attrset.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Add nixpkgs.config.blocklistedLicenses = [ pkgs.lib.licenses.sspl ]; (can use also allowlistedLicenses) in NixOS global configuration.
  2. Try to build configuration.

Expected behavior

  • Can build your system unless it references package with license sspl (I guess Mongodb related stuff) and which is referenced in blocklistedLicenses.

  • Can reference licenses in-lined in packages . E.g. pkgs.ntp.meta.license (or its direct value)

license = {
# very close to isc and bsd2
url = "https://www.eecis.udel.edu/~mills/ntp/html/copyright.html";
};

Screenshots

error: ‘SSPL’ is not an attribute of lib.licenses

       … while evaluating anonymous lambda

       at /nix/store/9lx5wss5ky22gjfwwr2ia2h6h6f039qb-source/pkgs/stdenv/generic/check-meta.nix:23:20:

           22|   onlyLicenses = list:
           23|     lib.lists.all (license:
             |                    ^
           24|       let l = lib.licenses.${license.shortName or "BROKEN"} or false; in

       … from call site
...
       at /nix/store/9lx5wss5ky22gjfwwr2ia2h6h6f039qb-source/pkgs/stdenv/generic/check-meta.nix:31:14:

           30|     if lib.mutuallyExclusive allowlist blocklist then
           31|       assert onlyLicenses allowlist; assert onlyLicenses blocklist; true
             |              ^
           32|     else

       … while evaluating 'checkValidity'
...
       at /nix/store/9lx5wss5ky22gjfwwr2ia2h6h6f039qb-source/lib/attrsets.nix:369:15:

          368|       inherit name;
          369|       value = f name (catAttrs name sets);
             |               ^
          370|     }) names);

       … while evaluating the attribute 'ssh'

Additional context

This was found out in attempt to use pre-approved list of "safe" open source licenses by adding in blocklistedLicenses all that are not on the list but present in lib.licenses. But sspl have next definition (notice upper case in shortName):

nixpkgs/lib/licenses.nix

Lines 757 to 759 in 048fd95

sspl = {
shortName = "SSPL";
fullName = "Server Side Public License";

In order to fully implement pre-approved "allow list" (different from allowlistedLicenses) it is required to be able to reference licenses that are in package meta but not in lib.licenses.

Notify maintainers

MongoDB maintainers: @bluescreen303 @offline @cstrahan

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

zsh%  nix run nixpkgs\#nix-info -- -m
  • system: "x86_64-linux"
  • host os: Linux 5.10.81, NixOS, 21.11 (Porcupine)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.4
  • channels(root): "nixos-21.11.334684.1158f346391"
  • channels(nikolay): "nixpkgs-unstable-21.11pre310022.14b0f20fa1f"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions