cabal2nix/FromCabal.License: use getLicenseFromSpdxId for SPDX licenses#708
Merged
sternenseemann merged 1 commit intomasterfrom Mar 21, 2026
Merged
cabal2nix/FromCabal.License: use getLicenseFromSpdxId for SPDX licenses#708sternenseemann merged 1 commit intomasterfrom
sternenseemann merged 1 commit intomasterfrom
Conversation
Member
|
I like it. I wished we could have a good fallback solution when parsing from cabal as well. |
Nixpkgs' lib.licenses does not actually contain all SPDX licenses, as stated in the upstream documentation <https://nixos.org/manual/nixpkgs/stable/#function-library-lib.meta.licensesSpdx>. Instead of (again) tracking which licenses are in Nixpkgs and which aren't we can simply use the `lib.meta.getLicenseFromSpdxId` function which returns a fallback value if the SPDX license id is unknown to Nixpkgs.
7e175a7 to
288c8a9
Compare
Member
Author
As said, we have some data on SPDX licenses, e.g. the full name. We could generate a decent fallback set with the id, the full title and maybe a link to spdx.org, but I think it would be a problematic increase in code size for Nixpkgs where we would never need the fallback. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Nixpkgs' lib.licenses does not actually contain all SPDX licenses, as stated in the upstream documentation
https://nixos.org/manual/nixpkgs/stable/#function-library-lib.meta.licensesSpdx.
Instead of (again) tracking which licenses are in Nixpkgs and which aren't we can simply use the
lib.meta.getLicenseFromSpdxIdfunction which returns a fallback value if the SPDX license id is unknown to Nixpkgs.