8ace65ff3d
* mpd-touch-screen-gui: use finalAttrs in mkDerivation; reformat * musescore: use finalAttrs in mkDerivation * syncthingtray: use stdenv.mkDerivation with a function; reformat * ocrfeeder: use finalAttrs in mkDerivation; reformat * castget: use finalAttrs in mkDerivation * gnome-network-displays: use finalAttrs in mkDerivation * mailreaders: use finalAttrs in mkDerivation * mswatch: use finalAttrs in mkDerivation * uhd: use finalAttrs in mkDerivation * maxima: use finalAttrs in mkDerivation * qalculate-gtk: use finalAttrs in mkDerivation * qalculate-qt: use finalAttrs in mkDerivation * wxmaxima: use finalAttrs in mkDerivation * lammps: use finalAttrs in mkDerivation * mlterm: use finalAttrs in mkDerivation * video-trimmer: use finalAttrs in mkDerivation * nerdfonts: use finalAttrs in mkDerivation * gnomeExtensions.easyScreenCast: use finalAttrs in mkDerivation * octave: use finalAttrs in mkDerivation; reformat * comedilib: use finalAttrs in mkDerivation * cpp-utilities: use finalAttrs in mkDerivation * libsForQt5.kpeoplevcard: use finalAttrs in mkDerivation; reformat * liberio: use finalAttrs in mkDerivation * libqalculate: use finalAttrs in mkDerivation; reformat * libwtk-sdl2: use finalAttrs in mkDerivation * libsForQt5.pulseaudio-qt: use finalAttrs in mkDerivation; reformat * qrupdate: use finalAttrs in mkDerivation; reformat * libsForQt5.qtforkawesome: use finalAttrs in mkDerivation; reformat * libsForQt5.qtutilities: use finalAttrs in mkDerivation; reformat * sqlitecpp: use finalAttrs in mkDerivation; reformat * tweeny: use finalAttrs in mkDerivation * volk: use finalAttrs in mkDerivation * wiringpi: use finalAttrs in mkDerivation * snzip: use finalAttrs in mkDerivation; reformat * bpm-tools: use finalAttrs in mkDerivation; reformat * sacd: use finalAttrs in mkDerivation * gtk-gnutella: use finalAttrs in mkDerivation; reformat * sile: use finalAttrs in mkDerivation * pplatex: use finalAttrs in mkDerivation; reformat
73 lines
2.3 KiB
Nix
73 lines
2.3 KiB
Nix
{ stdenv
|
|
, fetchurl
|
|
, lib
|
|
# To select only certain fonts, put a list of strings to `fonts`: every key in
|
|
# ./shas.nix is an optional font
|
|
, fonts ? []
|
|
# Whether to enable Windows font variants, their internal font name is limited
|
|
# to 31 characters
|
|
, enableWindowsFonts ? false
|
|
}:
|
|
|
|
let
|
|
# both of these files are generated via ./update.sh
|
|
version = import ./version.nix;
|
|
fontsShas = import ./shas.nix;
|
|
knownFonts = builtins.attrNames fontsShas;
|
|
selectedFonts = if (fonts == []) then
|
|
knownFonts
|
|
else
|
|
let unknown = lib.subtractLists knownFonts fonts; in
|
|
if (unknown != []) then
|
|
throw "Unknown font(s): ${lib.concatStringsSep " " unknown}"
|
|
else
|
|
fonts
|
|
;
|
|
selectedFontsShas = lib.attrsets.genAttrs selectedFonts (
|
|
fName:
|
|
fontsShas."${fName}"
|
|
);
|
|
srcs = lib.attrsets.mapAttrsToList (
|
|
fName:
|
|
fSha:
|
|
(fetchurl {
|
|
url = "https://github.com/ryanoasis/nerd-fonts/releases/download/v${version}/${fName}.tar.xz";
|
|
sha256 = fSha;
|
|
})
|
|
) selectedFontsShas;
|
|
in
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
inherit version;
|
|
inherit srcs;
|
|
pname = "nerdfonts";
|
|
sourceRoot = ".";
|
|
buildPhase = ''
|
|
echo "selected fonts are ${toString selectedFonts}"
|
|
ls *.otf *.ttf
|
|
'';
|
|
installPhase = ''
|
|
find -name \*.otf -exec mkdir -p $out/share/fonts/opentype/NerdFonts \; -exec mv {} $out/share/fonts/opentype/NerdFonts \;
|
|
find -name \*.ttf -exec mkdir -p $out/share/fonts/truetype/NerdFonts \; -exec mv {} $out/share/fonts/truetype/NerdFonts \;
|
|
${lib.optionalString (! enableWindowsFonts) ''
|
|
rm -rfv $out/share/fonts/opentype/NerdFonts/*Windows\ Compatible.*
|
|
rm -rfv $out/share/fonts/truetype/NerdFonts/*Windows\ Compatible.*
|
|
''}
|
|
'';
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
meta = with lib; {
|
|
description = "Iconic font aggregator, collection, & patcher. 3,600+ icons, 50+ patched fonts";
|
|
longDescription = ''
|
|
Nerd Fonts is a project that attempts to patch as many developer targeted
|
|
and/or used fonts as possible. The patch is to specifically add a high
|
|
number of additional glyphs from popular 'iconic fonts' such as Font
|
|
Awesome, Devicons, Octicons, and others.
|
|
'';
|
|
homepage = "https://nerdfonts.com/";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ doronbehar ];
|
|
hydraPlatforms = []; # 'Output limit exceeded' on Hydra
|
|
};
|
|
})
|