Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
104 lines
2.8 KiB
Nix
104 lines
2.8 KiB
Nix
{
|
|
lib,
|
|
stdenvNoCC,
|
|
fetchurl,
|
|
}:
|
|
|
|
let
|
|
releaseInfo = lib.trivial.importJSON ./manifests/release.json;
|
|
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;
|
|
|
|
convertVersion =
|
|
version: if builtins.match "^[[:digit:]].*" version != null then "+" + version else "";
|
|
|
|
convertLicense = import ./convert-license.nix lib;
|
|
|
|
makeNerdFont =
|
|
{
|
|
caskName,
|
|
description,
|
|
folderName,
|
|
licenseId,
|
|
patchedName,
|
|
version,
|
|
...
|
|
}:
|
|
stdenvNoCC.mkDerivation {
|
|
pname = "nerd-fonts-" + lib.strings.toLower caskName;
|
|
version = releaseVersion + convertVersion version;
|
|
|
|
src =
|
|
let
|
|
filename = folderName + ".tar.xz";
|
|
url = "https://github.com/ryanoasis/nerd-fonts/releases/download/${releaseInfo.tag_name}/${filename}";
|
|
sha256 = checksums.${filename};
|
|
in
|
|
fetchurl {
|
|
inherit url sha256;
|
|
};
|
|
|
|
sourceRoot = ".";
|
|
|
|
installPhase =
|
|
let
|
|
dirName = lib.strings.concatStrings (lib.strings.splitString " " patchedName);
|
|
in
|
|
''
|
|
runHook preInstall
|
|
|
|
dst_opentype=$out/share/fonts/opentype/NerdFonts/${dirName}
|
|
dst_truetype=$out/share/fonts/truetype/NerdFonts/${dirName}
|
|
|
|
find -name \*.otf -exec mkdir -p $dst_opentype \; -exec cp -p {} $dst_opentype \;
|
|
find -name \*.ttf -exec mkdir -p $dst_truetype \; -exec cp -p {} $dst_truetype \;
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
passthru = {
|
|
inherit releaseVersion;
|
|
updateScript = {
|
|
command = ./update.py;
|
|
supportedFeatures = [ "commit" ];
|
|
};
|
|
};
|
|
|
|
meta = {
|
|
description = "Nerd Fonts: " + description;
|
|
license = lib.unique (
|
|
(with lib.licenses; [
|
|
# > Nerd Fonts source fonts, patched fonts, and folders with explicit 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;
|
|
maintainers = with lib.maintainers; [
|
|
doronbehar
|
|
rc-zb
|
|
];
|
|
};
|
|
};
|
|
|
|
nerdFonts = lib.trivial.pipe fontsInfo [
|
|
(map (font: lib.nameValuePair (convertAttrName font.caskName) (makeNerdFont font)))
|
|
builtins.listToAttrs
|
|
];
|
|
in
|
|
|
|
nerdFonts
|