-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nerdfonts: separate into individual packages under namespace nerd-fonts
- Loading branch information
Showing
14 changed files
with
6,562 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ lib }: | ||
let | ||
ls = lib.licenses; | ||
in | ||
licenseString: | ||
builtins.getAttr licenseString ( | ||
( | ||
with builtins; | ||
lib.trivial.pipe (attrValues ls) [ | ||
(filter (l: l ? spdxId)) | ||
(map (l: lib.attrsets.nameValuePair l.spdxId l)) | ||
listToAttrs | ||
] | ||
) | ||
// { | ||
"Bitstream-Vera AND MIT" = with ls; [ | ||
bitstreamVera | ||
mit | ||
]; | ||
"LicenseRef-Monofur" = ls.free; # upstream `src/unpatched-fonts/Monofur/LICENSE.txt` | ||
"LicenseRef-UbuntuFont" = ls.ufl; | ||
"LicenseRef-VicFieger" = ls.free; # upstream `src/unpatched-fonts/HeavyData/Vic Fieger License.txt` | ||
"MIT OR OFL-1.1-no-RFN" = ls.mit; | ||
"OFL-1.1-RFN" = ls.ofl; | ||
"OFL-1.1-no-RFN or LGPL-2.1-only" = ls.ofl; | ||
"OFL-1.1-no-RFN" = ls.ofl; | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
{ | ||
lib, | ||
callPackage, | ||
stdenvNoCC, | ||
fetchurl, | ||
}: | ||
|
||
let | ||
releaseInfo = lib.trivial.importJSON ./manifests/release.json; | ||
fontsInfo = (lib.trivial.importJSON ./manifests/fonts.json).fonts; | ||
hashes = lib.trivial.importJSON ./manifests/hashes.json; | ||
|
||
# Always aborts if finding nothing. | ||
firstFound = pred: lib.lists.findFirst pred (throw "nothing found"); | ||
|
||
convertAttrName = | ||
name: | ||
let | ||
lowerName = lib.strings.toLower name; | ||
in | ||
if builtins.match "[[:digit:]].*" lowerName != null then "_" + lowerName else lowerName; | ||
|
||
convertLicense = callPackage ./convert-license.nix { }; | ||
|
||
makeNerdFont = | ||
{ | ||
caskName, | ||
description, | ||
folderName, | ||
licenseId, | ||
patchedName, | ||
version, | ||
... | ||
}: | ||
stdenvNoCC.mkDerivation { | ||
pname = lib.strings.toLower caskName; | ||
version = | ||
if builtins.match "[[:digit:]].*" version != null then | ||
version | ||
else | ||
"0-unstable-" + builtins.head (lib.strings.splitString "T" releaseInfo.published_at); | ||
|
||
src = | ||
let | ||
filename = folderName + ".tar.xz"; | ||
url = (firstFound (a: a.name == filename) releaseInfo.assets).browser_download_url; | ||
hash = (firstFound (i: i.filename == filename) hashes).hash; | ||
in | ||
fetchurl { | ||
inherit url hash; | ||
}; | ||
|
||
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.updateScript = ./update.rb; | ||
|
||
meta = { | ||
description = "Nerd Fonts: " + description; | ||
license = 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 | ||
]; | ||
}; | ||
}; | ||
in | ||
|
||
builtins.listToAttrs ( | ||
map (font: lib.attrsets.nameValuePair (convertAttrName font.caskName) (makeNerdFont font)) fontsInfo | ||
) |
Oops, something went wrong.