Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nix setup does not validate licenses #4496

Closed
3 of 4 tasks
till opened this issue Dec 21, 2023 · 4 comments · Fixed by #4497
Closed
3 of 4 tasks

nix setup does not validate licenses #4496

till opened this issue Dec 21, 2023 · 4 comments · Fixed by #4497
Assignees
Labels
bug Something isn't working
Milestone

Comments

@till
Copy link
Contributor

till commented Dec 21, 2023

What happened?

So for private code, I think the best "bet" is to set the license to unfree.

But that's only what I found out after the fact — I set it to "proprietary" at first.

I am not sure if there's a better one to use, as I only read through the licenses.nix in the nixpkgs repo.

Anyway, having said all this, it would be nice if the pipeline could validate this, or maybe the config should do that? Or, add a little docs page how to distribute private code in form of documentation? Do you have any thoughts on this? I looked at the code, it seems like the license value is passed into the template that's rendered and that's it.

Also, not entirely sure if that's something that can be fixed in code. So a docs thing would work, IMHO? I can try to add something here: https://github.com/goreleaser/goreleaser/blob/c4dafdf55e8f1961ef20420d5d3514c6104046f9/www/docs/customization/nix.md

How can we reproduce this?

Set license to proprietary and watch the nur fail to build:

       error: attribute 'proprietary' missing
| 
|        at /Users/till/Documents/workspaces/reponur/pkgs/tool/default.nix:49:15:
| 
|            48|     homepage = "https://example.org/";
|            49|     license = lib.licenses.proprietary;
|              |               ^
|            50|

goreleaser version

current

GoReleaser Check

  • goreleaser check shows no errors

Search

  • I did search for other open and closed issues before opening this

Supporter

Code of Conduct

  • I agree to follow this project's Code of Conduct

Additional context

No response

@till till added bug Something isn't working triage Issue pending triage by one of the maintainers labels Dec 21, 2023
@caarlos0
Copy link
Member

we could do something like this:

nix-build -E 'with import <nixpkgs> {}; callPackage ./default.nix {}'

but it'll only work if the files have already been uploaded... so... not very useful, I think.

We might need to replicate the license list into goreleaser to prevent these issues 🤔

@caarlos0 caarlos0 removed the triage Issue pending triage by one of the maintainers label Dec 21, 2023
@caarlos0 caarlos0 added this to the v1.23.0 milestone Dec 21, 2023
caarlos0 added a commit that referenced this issue Dec 21, 2023
this will check if the license provided by the user is a valid one.

valid list of licenses is generated from nix's source code.

closes #4496
@caarlos0
Copy link
Member

see #4497

@till
Copy link
Contributor Author

till commented Dec 21, 2023

Wow, you're fast. I didn't expect anything so soon. 😁 But yeah, the generator seems to make sense. That could work.

caarlos0 added a commit that referenced this issue Dec 26, 2023
this will check if the license provided by the user is a valid one.

valid list of licenses is generated from nix's source code.

closes #4496
@till
Copy link
Contributor Author

till commented Dec 26, 2023

🚀 Thank you! Happy holidays!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants