Get license information from nixpkgs lib

This commit is contained in:
adisbladis 2020-01-01 17:00:03 +00:00
parent c499f3b342
commit 927ae249ef
No known key found for this signature in database
GPG key ID: 110BFAD44C6249B7
2 changed files with 7 additions and 5 deletions

View file

@ -20,6 +20,11 @@ let
else default
);
# Map SPDX identifiers to license names
spdxLicenses = lib.listToAttrs (lib.filter (pair: pair.name != null) (builtins.map (v: { name = if lib.hasAttr "spdxId" v then v.spdxId else null; value = v;}) (lib.attrValues lib.licenses)));
# Get license by id falling back to input string
getLicenseBySpdxId = spdxId: getAttrDefault spdxId spdxLicenses spdxId;
#
# Returns an attrset { python, poetryPackages } for the given lockfile
#
@ -196,8 +201,8 @@ let
'';
meta = meta // {
inherit (pyProject.tool.poetry) description;
license = pyProject.tool.poetry.license;
inherit (pyProject.tool.poetry) description homepage;
license = getLicenseBySpdxId (getAttrDefault "license" pyProject.tool.poetry "unknown");
};
}

View file

@ -59,9 +59,6 @@ poetry2nix.mkPoetryApplication {
doCheck = false;
meta = with lib; {
homepage = "https://python-poetry.org/";
description = "Python dependency management and packaging made easy";
license = licenses.mit;
platforms = platforms.all;
maintainers = with maintainers; [ adisbladis ];
};