forked from auxolotl/labs
Compare commits
3 commits
9477da5166
...
b67847e7eb
| Author | SHA1 | Date | |
|---|---|---|---|
| b67847e7eb | |||
| 45ac7bc494 | |||
| 8ffc63ae42 |
4 changed files with 34 additions and 20 deletions
|
|
@ -8,9 +8,9 @@
|
|||
},
|
||||
"branch": "main",
|
||||
"submodules": false,
|
||||
"revision": "ec6ba877756d3b898c75bdf8f75faff671fb3dbb",
|
||||
"revision": "f39cac8caec87b3d93bd2f941bcf8768dc46d912",
|
||||
"url": null,
|
||||
"hash": "sha256-wCnUEFuFu1YKo2iE/kZeEpg3G8sCWeijuHXHTctKpJQ="
|
||||
"hash": "sha256-LgdIew95Y3PBTTj8vV70gbWIyMPf3Fl30cM2WPWylNk="
|
||||
},
|
||||
"lib": {
|
||||
"type": "Git",
|
||||
|
|
|
|||
|
|
@ -243,11 +243,22 @@ in
|
|||
in
|
||||
outputs;
|
||||
|
||||
WELL_KNOWN_ALIASES = [
|
||||
# NOTE: When adding a version alias here, update lib.types.alias and lib.types.platforms' alias sub-option
|
||||
"stable"
|
||||
"latest"
|
||||
];
|
||||
|
||||
resolve =
|
||||
alias:
|
||||
if alias ? versions then
|
||||
alias.versions.${config.preferences.packages.version}
|
||||
or (alias.versions.${lib.packages.getLatest alias})
|
||||
let
|
||||
prefered = config.preferences.packages.version;
|
||||
isWellKnown = builtins.elem prefered lib.packages.WELL_KNOWN_ALIASES;
|
||||
in
|
||||
if isWellKnown && alias ? ${prefered} then
|
||||
alias.${prefered}
|
||||
else if alias ? versions then
|
||||
alias.versions.${prefered} or (alias.versions.${lib.packages.getLatest alias})
|
||||
else
|
||||
alias;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,19 +13,18 @@ in
|
|||
{ config }:
|
||||
{
|
||||
options = {
|
||||
name = {
|
||||
full = lib.options.create {
|
||||
description = "The full name of the license.";
|
||||
type = lib.types.string;
|
||||
};
|
||||
|
||||
short = lib.options.create {
|
||||
description = "The short name of the license.";
|
||||
type = lib.types.string;
|
||||
};
|
||||
name = lib.options.create {
|
||||
description = "The short name of the license.";
|
||||
type = lib.types.string;
|
||||
};
|
||||
|
||||
spdx = lib.options.create {
|
||||
fullName = lib.options.create {
|
||||
description = "The full name of the license.";
|
||||
type = lib.types.string;
|
||||
};
|
||||
|
||||
spdxId = lib.options.create {
|
||||
description = "The SPDX identifier for the license.";
|
||||
type = lib.types.nullish lib.types.string;
|
||||
default.value = null;
|
||||
|
|
@ -33,7 +32,11 @@ in
|
|||
|
||||
url = lib.options.create {
|
||||
description = "The URL for the license.";
|
||||
type = lib.types.nullish lib.types.string;
|
||||
type = lib.types.string;
|
||||
default = {
|
||||
text = "spdx.org entry, if `spdxId` is set, `null` otherwise";
|
||||
value = if config.spdxId == null then null else "https://spdx.org/licenses/${config.spdxId}.html";
|
||||
};
|
||||
};
|
||||
|
||||
free = lib.options.create {
|
||||
|
|
@ -304,6 +307,7 @@ in
|
|||
type = lib.types.artifact;
|
||||
default.value = null;
|
||||
};
|
||||
# NOTE: When adding a version alias here, update lib.packages.WELL_KNOWN_ALIASES
|
||||
versions = lib.options.create {
|
||||
description = "Available versions of the artifact.";
|
||||
type = lib.types.attrs.of lib.types.artifact;
|
||||
|
|
@ -398,6 +402,8 @@ in
|
|||
if config.versions == { } then null else config.versions.${lib.packages.getLatest config};
|
||||
};
|
||||
|
||||
# NOTE: When adding a version alias here, update lib.packages.WELL_KNOWN_ALIASES
|
||||
|
||||
versions = lib.options.create {
|
||||
description = "Available versions of the package.";
|
||||
type = lib.types.attrs.of lib.types.package;
|
||||
|
|
|
|||
|
|
@ -37,10 +37,7 @@ in
|
|||
preferences.packages = {
|
||||
version = lib.options.create {
|
||||
description = "The preferred package version when using aliases.";
|
||||
type = lib.types.enum [
|
||||
"latest"
|
||||
"stable"
|
||||
];
|
||||
type = lib.types.enum lib.packages.WELL_KNOWN_ALIASES;
|
||||
default.value = "latest";
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue