query
On this page

mkLicense

lib.licenses.mkLicense

Docs pulled from | This Revision | 20 minutes ago


Nixpkgs manual

Create a license.

Inputs

licenseInfo
Attrset of license infromation

Type

mkLicense :: AttrSet -> AttrSet

Example

lib.licenses.mkLicense usage example

mkLicense { shortName = "my-license"; }
=> { shortName = "my-license"; free = true; deprecated = false; redistributable = true; licenseType = "simple"; }

Noogle detected

Implementation

The following is the current implementation of this function.

mkLicense =
    {
      shortName,
      # Most of our licenses are Free, explicitly declare unfree additions as such!
      free ? true,
      deprecated ? false,
      spdxId ? null,
      url ? null,
      fullName ? null,
      redistributable ? free,
    }@attrs:
    {
      inherit
        shortName
        free
        deprecated
        redistributable
        ;
      licenseType = "simple";
    }
    // optionalAttrs (attrs ? spdxId) {
      inherit spdxId;
      url = "https://spdx.org/licenses/${spdxId}.html";
    }
    // optionalAttrs (attrs ? url) {
      inherit url;
    }
    // optionalAttrs (attrs ? fullName) {
      inherit fullName;
    };