NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.1k stars 13.4k forks source link

Packages with meta.license as string are always considered as free #269788

Open adisbladis opened 9 months ago

adisbladis commented 9 months ago

Describe the bug

Due to a logic bug in check-meta.nix all packages where meta.license is a bare string are always considered to be free. We should consider all licenses that we do not know to be free to be unfree.

The current implementation looks like:

isUnfree = licenses: lib.lists.any (l: !l.free or true) licenses;

which always evaluates to !true for strings.

Steps To Reproduce

Steps to reproduce the behavior:

  1. nix-instantiate ./. -A boehmgc

Expected behavior

All unknown licenses are considered unfree.

Proposed solution

I suggest that we fix the issue by first making all meta.license fields structured on all packages. Once that's done we can change isUnfree from check-meta.nix to correctly return true for bare strings.

Methodology

I've dumped the script I've used to find packages with bare strings as meta.license in https://gist.github.com/adisbladis/b5aa64ded97712e062728bd033e90fa2.

Notify maintainers

Affected packages:

Metadata

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

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
output here

Priorities

Add a :+1: reaction to issues you find important.

aidalgol commented 9 months ago

Created #269789 to address this in teensy-udev-rules.

bbjubjub2494 commented 9 months ago

teck-programmer and teck-udev-rules should be done with #269855

ncfavier commented 9 months ago

Maybe you could explain what should be done with stringy licenses, like

AndersonTorres commented 9 months ago

Maybe you could explain what should be done with stringy licenses

Convert them to not-so-stringly ones.

Artturin commented 9 months ago

License can be an attrset

For example this

license  = {
    fullName = "Oracle VM VirtualBox Extension Pack Personal Use and Evaluation License (PUEL)";
    url = "https://www.virtualbox.org/wiki/VirtualBox_PUEL";
    free = false;
};

is the same thing as

license = licenses.virtualbox-puel

https://github.com/NixOS/nixpkgs/blob/f2d3ee6d90350ed6fa9f8cc927decad45c6bab33/lib/licenses.nix#L1137-L1140

pbsds commented 9 months ago

string licenses should be eval error, with a helpful error message

Artturin commented 9 months ago

https://github.com/NixOS/nixpkgs/blob/911ce27f7ec3742e396928da3ccb25c17566bdfe/pkgs/stdenv/generic/check-meta.nix#L267-L269

AndersonTorres commented 9 months ago

string licenses should be eval error, with a helpful error message

For now a warning is better.

Luflosi commented 8 months ago

Can someone please tick off teeworlds and teeworlds-server and possibly some others that have been fixed since?

Luflosi commented 8 months ago

Thank you. teensy-udev-rules, ocamlPackages.caqti, ocamlPackages.caqti-async, ocamlPackages.caqti-driver-mariadb, ocamlPackages.caqti-driver-postgresql, ocamlPackages.caqti-dynload, ocamlPackages.caqti-lwt, ocamlPackages.caqti-driver-sqlite3 and ocamlPackages.caqti-type-calendar can also be marked as done.

bjornfor commented 8 months ago

Thank you. teensy-udev-rules, ocamlPackages.caqti, ocamlPackages.caqti-async, ocamlPackages.caqti-driver-mariadb, ocamlPackages.caqti-driver-postgresql, ocamlPackages.caqti-dynload, ocamlPackages.caqti-lwt, ocamlPackages.caqti-driver-sqlite3 and ocamlPackages.caqti-type-calendar can also be marked as done.

Marked as done. (Thanks!)

Luflosi commented 8 months ago

postcss-cli can also be checked off.

SuperSandro2000 commented 8 months ago

For now a warning is better.

which gets treated by ofborg as a hard failure....

AndersonTorres commented 8 months ago

which gets treated by ofborg as a hard failure....

Even in old code? Not that I think it is a problem at all. The monorepo can be stricter than a local instance.

SuperSandro2000 commented 8 months ago

Even in old code?

Yes. You cannot yield any lib.warn in the paths that ofborg checks. If the code is technically unused within nixpkgs from the things ofborg checks and may only be triggered by out of tree things, then it is fine.

necessarily-equal commented 7 months ago

bookletimposer can be handled by deleting the package https://github.com/NixOS/nixpkgs/pull/278100