Repository navigation
_cuda.lib.allowUnfreeCudaPredicate: handle compound licenses - #550208
Conversation
e656fb7 to
c56f477
Compare
|
Okay, |
|
I recall https://discourse.nixos.org/t/compound-licenses/78532/ this popping up in my email and me thinking exactly these words, not sure we're prepared to work with more detailed/complex data |
|
@ConnorBaker I have no idea. My stuff fell apart and I saw this as the quickest, low dirty way to fix stuff. |
c56f477 to
fc0c2cd
Compare
|
I re-used a helper from lib.licenses to avoid adding to much duplicated logic. |
|
This worked for one of my machines but fell apart for another one .... |
56aabfb to
664ab37
Compare
664ab37 to
b644b7e
Compare
Side tangent: maybe a bit ranty/frustrated.TBH: We have `config.allowlistedLicenses` to allow specific licenses, without allowing all other unfree licenses, so why does CUDA need their own allowed license implementation using `config.allowPredicate` instead of just providing a simple list for `config.allowlistedLicenses`? |
|
Good question, that would make things probably a lot easier. |
|
@NixOS/cuda-maintainers Can we move forward with this? It is becoming a problem for me in feature branches. |
The PR introducing "compound" licenses really should not have changed the signature of We're syncing on whether we're ok adding the hack nonetheless... |
They don't need to be listed in config.allowlistedLicenses = [
lib.licenses.nvidiaCuda
lib.licenses.nvidiaCudaRedist
]
++ lib.attrValues _cuda.lib.licenses;
The signature of licenses is just any attrs or string or list of those (and you could find very wild stuff in the license field before I clean it up a bit).
There is no other than an implied looks similar to the ones in
Yes, it handles them via |
|
this would have the same result as your current `allowUnfreePredicate`.
I'm afraid not, _cuda.lib.licenses does not contain all instantiations of cuda-related licenses (also this highlights another lossy rebase, probably coming from the cuda13 PR, which dropped the //{ url = ... } part for a TODO comment xDD)
The signature of licenses is just any attrs or string or list of those
It's not, hasn't been for a long time! We've had an mkLicense primitive which enforced that a bunch of attributes must exist, we've had maybe Emily or Philip patch up the ad hoc licenses in cudaPackages to satisfy the same format, so we've definitely had a notion of a "License" type/interface, however loose, and the signature indeed was (License | [License]) -> Bool
…On 19 August 2026 05:45:21 UTC, Jo ***@***.***> wrote:
jopejoe1 left a comment (NixOS/nixpkgs#550208)
> > TBH: We have `config.allowlistedLicenses` to allow specific licenses, without allowing all other unfree licenses, so why does CUDA need their own allowed license implementation using `config.allowPredicate` instead of just providing a simple list for
>
> `allowListedLicenses` compares attrsets, not shortNames; CUDAToolkit consists of 10s of components each of which come with a copy of the same license but e.g. a different URL, so these licenses are not going into `lib.licenses`.
They don't need to be listed in `lib.licenses` to be included in `config.allowlistedLicenses` settings `config.allowlistedLicenses` to this would have the same result as your current `allowUnfreePredicate`.
```nix
config.allowlistedLicenses = [
lib.licenses.nvidiaCuda
lib.licenses.nvidiaCudaRedist
]
++ lib.attrValues _cuda.lib.licenses;
```
> The PR introducing "compound" licenses really should not have changed the signature of `allowUnfreePredicate`.
The signature of licenses is just any attrs or string or list of those (and you could find very wild stuff in the license).
> What is the canonical format?
There is no other than an implied looks similar to the ones in `lib.licenses`, im working on creating one, but it does not exist yet.
> I know that there’s a check-meta — does it handle licenses?
Yes, it handles them via `allowlistedLicenses` and `blocklistedLicenses` and also does a type check.
|
|
(License | [License]) -> Bool
Well, OK, `(License | [License] | Str) -> Bool`, the latter of which check-meta apparently accepts but we actually didn't know to handle
…On 19 August 2026 06:04:53 UTC, Someone ***@***.***> wrote:
SomeoneSerge left a comment (NixOS/nixpkgs#550208)
> this would have the same result as your current `allowUnfreePredicate`.
I'm afraid not, _cuda.lib.licenses does not contain all instantiations of cuda-related licenses (also this highlights another lossy rebase, probably coming from the cuda13 PR, which dropped the //{ url = ... } part for a TODO comment xDD)
> The signature of licenses is just any attrs or string or list of those
It's not, hasn't been for a long time! We've had an mkLicense primitive which enforced that a bunch of attributes must exist, we've had maybe Emily or Philip patch up the ad hoc licenses in cudaPackages to satisfy the same format, so we've definitely had a notion of a "License" type/interface, however loose, and the signature indeed was (License | [License]) -> Bool
On 19 August 2026 05:45:21 UTC, Jo ***@***.***> wrote:
>jopejoe1 left a comment (NixOS/nixpkgs#550208)
>
>> > TBH: We have `config.allowlistedLicenses` to allow specific licenses, without allowing all other unfree licenses, so why does CUDA need their own allowed license implementation using `config.allowPredicate` instead of just providing a simple list for
>>
>> `allowListedLicenses` compares attrsets, not shortNames; CUDAToolkit consists of 10s of components each of which come with a copy of the same license but e.g. a different URL, so these licenses are not going into `lib.licenses`.
>
>They don't need to be listed in `lib.licenses` to be included in `config.allowlistedLicenses` settings `config.allowlistedLicenses` to this would have the same result as your current `allowUnfreePredicate`.
>```nix
>config.allowlistedLicenses = [
> lib.licenses.nvidiaCuda
> lib.licenses.nvidiaCudaRedist
>]
>++ lib.attrValues _cuda.lib.licenses;
>```
>
>> The PR introducing "compound" licenses really should not have changed the signature of `allowUnfreePredicate`.
>
>The signature of licenses is just any attrs or string or list of those (and you could find very wild stuff in the license).
>
>> What is the canonical format?
>
>There is no other than an implied looks similar to the ones in `lib.licenses`, im working on creating one, but it does not exist yet.
>
>> I know that there’s a check-meta — does it handle licenses?
>
>Yes, it handles them via `allowlistedLicenses` and `blocklistedLicenses` and also does a type check.
>
|
I wish that were the case, but sadly it still is not the reality, we are still working on actually implementing that fully. |
Except yes they did, otherwise you run into infinite recursion because the package set cannot depend on its values in such a fashion: $ git checkout f6a38f9a4e93843f83942b735f316ff85d495600
$ nix eval -f . --arg config '{pkgs, ...}: { allowlistedLicenses = [pkgs.lib.licenses.nvidiaCuda pkgs.lib.licenses.nvidiaCudaRedist] ++ pkgs.lib.attrValues pkgs._cuda.lib.licenses; }' cudaPackages.cudnn
error:
… while evaluating a branch condition
at /home/connorbaker/nixpkgs/pkgs/stdenv/booter.nix:107:9:
106| thisStage =
107| if args.__raw or false then
| ^
108| args'
… in the right operand of the update (//) operator
at /home/connorbaker/nixpkgs/pkgs/stdenv/booter.nix:90:48:
89| # for the final stage.
90| { allowCustomOverrides = index == 1; } // (stageFun prevStage)
| ^
91| ) (lib.lists.reverseList stageFuns);
… while evaluating definitions from `nixpkgs.config':
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: infinite recursion encountered
at «string»:1:107:
1| {pkgs, ...}: { allowlistedLicenses = [pkgs.lib.licenses.nvidiaCuda pkgs.lib.licenses.nvidiaCudaRedist] ++ pkgs.lib.attrValues pkgs._cuda.lib.licenses; }
|It works now, but that is the result of other changes to config.nix: $ git checkout master
Updating files: 100% (45890/45890), done.
Previous HEAD position was f6a38f9a4e93 Revert "config: add and document {allow,block}listedLicenses"
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
$ nix eval -f . --arg config '{pkgs, ...}: { allowlistedLicenses = [pkgs.lib.licenses.nvidiaCuda pkgs.lib.licenses.nvidiaCudaRedist] ++ pkgs.lib.attrValues pkgs._cuda.lib.licenses; }' cudaPackages.cudnn
«derivation /nix/store/xahxp5z24n3bhh0ab51aiz3h2slqa24v-cuda12.9-cudnn-9.22.0.52.drv»Using Also different are the semantics: join (allow list) vs. meet (our predicate). As well as the method of comparison. |
|
So what are we doing now? 😅 |
|
@SuperSandro2000 hi, sorry about latency, them are crazy times... we had concluded we should've probably merged your patch right away and then pushed for reverting and reworking compound licenses after the fact, but then everyone got distracted by a 1000 other urgent things. Apologies. Pre-merge check: Details
$ nix eval -I nixpkgs=flake:github:SuperSandro2000/nixpkgs/cuda-license -f "" --arg config '{ pkgs, ... }: { allowUnfreePredicate = pkgs._cuda.lib.allowUnfreeCudaPredicate; }' cudaPackages.cuda_nvcc
«derivation /nix/store/nmwccpzdf933kc8pwyqq8g8x5czglwcx-cuda12.9-cuda_nvcc-12.9.86.drv»
PS To anyone else reading: |
|
Successfully created backport PR for |
Some package I use has a compound license (no idea which)
I could only find out that it is this license:
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.