nerd-fonts: fix and improve pname, version and license handling (#370225)

This commit is contained in:
Doron Behar
2025-01-02 15:51:01 +02:00
committed by GitHub
3 changed files with 24 additions and 16 deletions
+22 -13
View File
@@ -9,19 +9,17 @@ let
fontsInfo = lib.trivial.importJSON ./manifests/fonts.json;
checksums = lib.trivial.importJSON ./manifests/checksums.json;
releaseVersion = lib.removePrefix "v" releaseInfo.tag_name;
convertAttrName =
name:
let
lowerName = lib.strings.toLower name;
in
if builtins.match "[[:digit:]].*" lowerName != null then "_" + lowerName else lowerName;
if builtins.match "^[[:digit:]].*" lowerName != null then "_" + lowerName else lowerName;
convertVersion =
version: date:
if builtins.match "[[:digit:]].*" version != null then
version
else
"0-unstable-" + builtins.head (lib.strings.splitString "T" date);
version: if builtins.match "^[[:digit:]].*" version != null then "+" + version else "";
convertLicense = import ./convert-license.nix lib;
@@ -36,8 +34,8 @@ let
...
}:
stdenvNoCC.mkDerivation {
pname = lib.strings.toLower caskName;
version = convertVersion version releaseInfo.published_at;
pname = "nerd-fonts-" + lib.strings.toLower caskName;
version = releaseVersion + convertVersion version;
src =
let
@@ -67,14 +65,25 @@ let
runHook postInstall
'';
passthru.updateScript = {
command = ./update.py;
supportedFeatures = [ "commit" ];
passthru = {
inherit releaseVersion;
updateScript = {
command = ./update.py;
supportedFeatures = [ "commit" ];
};
};
meta = {
description = "Nerd Fonts: " + description;
license = convertLicense licenseId;
license = lib.unique (
(with lib.licenses; [
# > Nerd Fonts source fonts, patched fonts, and folders with explict OFL SIL files
ofl
# > Nerd Fonts original source code files (such as `.sh`, `.py`, `font-patcher` and others)
mit
])
++ lib.toList (convertLicense licenseId)
);
homepage = "https://nerdfonts.com/";
changelog = "https://github.com/ryanoasis/nerd-fonts/blob/${releaseInfo.tag_name}/changelog.md";
platforms = lib.platforms.all;
@@ -86,7 +95,7 @@ let
};
nerdFonts = lib.trivial.pipe fontsInfo [
(map (font: lib.attrsets.nameValuePair (convertAttrName font.caskName) (makeNerdFont font)))
(map (font: lib.nameValuePair (convertAttrName font.caskName) (makeNerdFont font)))
builtins.listToAttrs
];
in
@@ -1,4 +1,3 @@
{
"tag_name": "v3.3.0",
"published_at": "2024-11-18T12:43:12Z"
"tag_name": "v3.3.0"
}
+1 -1
View File
@@ -40,7 +40,7 @@ os.chdir(os.path.join(os.path.dirname(os.path.abspath(__file__)), "manifests"))
release_info = slicedict(
fetchjson(RELEASE_INFO_URL),
["tag_name", "published_at"]
["tag_name"]
)
tag_name = release_info["tag_name"]