Merge pull request #84858 from doronbehar/improve-nerd-fonts
nerdfonts: make it easier to configure and build
This commit is contained in:
commit
87d3217761
@ -1,28 +0,0 @@
|
||||
{ lib, fetchzip }:
|
||||
|
||||
let
|
||||
version = "2.0.0";
|
||||
in fetchzip {
|
||||
name = "inconsolata-nerdfont-${version}";
|
||||
|
||||
url = "https://github.com/ryanoasis/nerd-fonts/releases/download/v${version}/Inconsolata.zip";
|
||||
|
||||
postFetch = ''
|
||||
mkdir -p $out/share/fonts/inconsolata-nerdfont
|
||||
unzip -j $downloadedFile -d $out/share/fonts/inconsolata-nerdfont
|
||||
'';
|
||||
|
||||
sha256 = "06i1akjblqd038cn5lvz67lwp6afpv31vqcfdihp66qisgbgm4w9";
|
||||
|
||||
meta = with lib; {
|
||||
description = ''
|
||||
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://github.com/ryanoasis/nerd-fonts;
|
||||
license = licenses.mit;
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
@ -1,35 +1,68 @@
|
||||
{ stdenv, fetchFromGitHub, which, withFont ? "" }:
|
||||
{ stdenv
|
||||
, fetchurl
|
||||
, lib
|
||||
, unzip
|
||||
# To select only certain fonts, put a list of strings to `fonts`: every key in
|
||||
# ./shas.nix is an optional font
|
||||
, fonts ? []
|
||||
}:
|
||||
|
||||
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}.zip";
|
||||
sha256 = fSha;
|
||||
})
|
||||
) selectedFontsShas;
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
version = "2.1.0";
|
||||
inherit version;
|
||||
inherit srcs;
|
||||
pname = "nerdfonts";
|
||||
src = fetchFromGitHub {
|
||||
owner = "ryanoasis";
|
||||
repo = "nerd-fonts";
|
||||
rev = version;
|
||||
sha256 = "1la79y16k9rwcl2zsxk73c0kgdms2ma43kpjfqnq5jlbfdj0niwg";
|
||||
};
|
||||
dontPatchShebangs = true;
|
||||
buildInputs = [ which ];
|
||||
patchPhase = ''
|
||||
patchShebangs install.sh
|
||||
sed -i -e 's|font_dir="\$HOME/.local/share/fonts|font_dir="$out/share/fonts/truetype|g' install.sh
|
||||
nativeBuildInputs = [
|
||||
unzip
|
||||
];
|
||||
sourceRoot = ".";
|
||||
buildPhase = ''
|
||||
echo "selected fonts are ${toString selectedFonts}"
|
||||
ls *.otf *.ttf
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir -p $out/share/fonts/truetype
|
||||
./install.sh ${withFont}
|
||||
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 \;
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = ''
|
||||
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://github.com/ryanoasis/nerd-fonts;
|
||||
homepage = "https://nerdfonts.com/";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ ];
|
||||
maintainers = with maintainers; [ doronbehar ];
|
||||
hydraPlatforms = []; # 'Output limit exceeded' on Hydra
|
||||
};
|
||||
}
|
||||
|
49
pkgs/data/fonts/nerdfonts/shas.nix
Normal file
49
pkgs/data/fonts/nerdfonts/shas.nix
Normal file
@ -0,0 +1,49 @@
|
||||
{
|
||||
"3270" = "1k71zsijasn6013c58pgf52xw3h9gkqdjlsa177wlldz8qxb16xk";
|
||||
"Agave" = "0jgm31wvmckb71qc9l0nj3sg4zq2vw67piaxr6h8zkakcl2mysha";
|
||||
"AnonymousPro" = "0s3n8rrr9kfqd8gxjxksp7p8bc3q7qhcrpyq8090dksvmbcks6xm";
|
||||
"Arimo" = "1k7ldfx6dmy9sigzsvi9qwms510nddw634g8xrn0vwnw6d7infk8";
|
||||
"AurulentSansMono" = "0q35948dai8qc7gfvas8sfn5s7b64b2y4f9psz6xslrv7nw8lcaz";
|
||||
"BigBlueTerminal" = "0ymw2m2xjsx77brm79aws26icwcf2a1d7q3p3ipsd25g4cgqcd2v";
|
||||
"BitstreamVeraSansMono" = "1n2298g1fn8jb1fbvw74289n7nnmjddn7zxh88gnl58pwz8ra5dk";
|
||||
"CascadiaCode" = "1q4l5a7b7ab6h1bs5pq734r9pp3fw9b59gdk1g4hyn2w61h0kdcj";
|
||||
"CodeNewRoman" = "1mgxawj3pblaxy0y9w0hzlfgipiskmc5p028m82zh1wyaplmh2pa";
|
||||
"Cousine" = "0jr0gxrsba3dhchp53vd67qq2pgfnvmvcwbv99l1700p539bcvy1";
|
||||
"DaddyTimeMono" = "1n6vwykz084fxgylayizxc210f4ms2ijfws5b2hvl2kqmy2q6jk4";
|
||||
"DejaVuSansMono" = "03qfrkzmhnn8dwgx4qhiigbz4dxs3957hydlr0j8vxl89j8c9g1z";
|
||||
"DroidSansMono" = "187cbcn4a2whrl8dag1ix6j1v3jgv5z2jdfw1w1z9llm1znvpp7z";
|
||||
"FantasqueSansMono" = "147h15k3ni0w6chxkrah2fk4klhdhq8y1d3nbx763h9ia3mnggv6";
|
||||
"FiraCode" = "1rx7zrkq0584k6hrh6dx30xrnz5nq379xyw73pfd4gxaxnh9mpi1";
|
||||
"FiraMono" = "0f2daidakhmbbd5ph6985rghjmr87k7xzmmmf9n851dxvfyndsgl";
|
||||
"Go-Mono" = "1bzh3pgyn87j27kw7x5h02rqzhh21pm6d0zhxd5iqi5qq5mj0nvm";
|
||||
"Gohu" = "1rlkprjg9nz1s69s4ancmxii6l907qachl116gngbj8gjv3g1x21";
|
||||
"Hack" = "052mav170lwxkgzg3hij4zvnmfwyrddn45gn07a33gpzzicjx1bh";
|
||||
"Hasklig" = "0vyb0z0m04pn8477d6a711vjwb3nhvpn5fxfwnz37av9jmz3i9vk";
|
||||
"HeavyData" = "065rhq7z52dp211inw3vszwc5zrd5s0w1kmgnrh68bxc0js0xqyb";
|
||||
"Hermit" = "1ij9pjr517jxk3dlsrzmnqivsfq5i5ai6pd8hznmrkb3360cn7sm";
|
||||
"iA-Writer" = "0clksrxw6xcv5c1pbd8rl2rc3r15iak1qv8v6bn0j2mccjcss64z";
|
||||
"IBMPlexMono" = "0xkfkpnkkrvjfiv624l7lpmfji107y7645w6ah47ijyg47yxkmsg";
|
||||
"Inconsolata" = "14gbwc0k3d1j496w6pv9kry1pglswzd0armsdb0g1mqgzfdf1ci1";
|
||||
"Iosevka" = "1qqd4xh98vxb99rh2a2qv9gjclilhaw84pyqdpbx225qhvw9xlkb";
|
||||
"JetBrainsMono" = "1kc8fyk1aczxkmn8dzv1gy6xfi2jywgahd8np576v2dn8kx16844";
|
||||
"Lekton" = "0mny5j9bns9104wg2wmabdw0sl80c7i3dzp4j5mxh8jybx929d3i";
|
||||
"LiberationMono" = "19bpm893assmmnfvlvhz8df54c9pr2kfv2b6anlr4g64hliy1c1h";
|
||||
"Meslo" = "08zm8nqskhrqkw80wl460zbvsrvs5fp2njlcv867phpqna9hyqzh";
|
||||
"Monofur" = "0f5khqgdxi4g0qm5n48r1sk4pd2wlk987d8yxwks2mcsqa6fraqj";
|
||||
"Monoid" = "0m7i82jfiwqmi9lhv8lmq2n723ihn0isxi5559478qbdy5b104dd";
|
||||
"Mononoki" = "074avnvfl260pcrli4h5bc55yqr4mgd54paf80qcnh101qsz325w";
|
||||
"MPlus" = "03mrfhzfmmqjfl7fa81v1ih3fdr3q2k439w6pjbd2zvl806l92yq";
|
||||
"Noto" = "1jmycnf4fflijs730vbyj258kajkxv0j42655a7hvpapym7z940z";
|
||||
"OpenDyslexic" = "0ma62xg6cy8l4chfhqvm64zzhx3mrzdj6gxwnvx8plqy3j4dn3by";
|
||||
"Overpass" = "1xs2z3ch7dd32zb5l1axzd78hyskimqglcjcrb7n4ic85qm55xxm";
|
||||
"ProFont" = "0ck4rprj0w29pv3qm4n1zg6cdq76m3kaag0ka4q1qqcnhga67zr7";
|
||||
"ProggyClean" = "0sk3gk6zj61nbv94xv6z8y67sr5blg9n079d8srv7bbw9dv96i8g";
|
||||
"RobotoMono" = "1nhbr9zc0cz81pdj95rrb56bwdkmmbqmk429nf60j35pkcqmvk8x";
|
||||
"ShareTechMono" = "1h79myy0my3jyrvqcrgfdsjqrwwm5fdy2nmzp3ynyi769p7z1dwr";
|
||||
"SourceCodePro" = "06cnsdmm84kzjlwwcmhwpj7pyfqinqpmww1c13i21l611fg6hwd7";
|
||||
"SpaceMono" = "1xmmf2gdsa3ycl3pgpr3zr919qh702wjvc5k4hsdivvs2lzfdgmk";
|
||||
"Terminus" = "0g2ybs225fwxmvwfnanc32jc2lfnag3agmliv1vrb5mxyqzm53gj";
|
||||
"Tinos" = "077n4k6yh4qbirfkl02zqn3057kymspr10zcbfkf4ldvifa36pjd";
|
||||
"Ubuntu" = "1lzdrgb8vk5dwicxhvkgbain5phf88g3zgv5ya2ihh052xsl3qih";
|
||||
"VictorMono" = "18z92kwggfqwrd5m09yda55hcb4b159278lps6f9hr8icwki6v9q";
|
||||
}
|
73
pkgs/data/fonts/nerdfonts/update.sh
Executable file
73
pkgs/data/fonts/nerdfonts/update.sh
Executable file
@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p rsstail nix-prefetch
|
||||
|
||||
# NOTE: Before running this script, please make sure this list is up-to-date -
|
||||
# meaning there are no new fonts they provide at https://github.com/ryanoasis/nerd-fonts/releases/
|
||||
fonts=(
|
||||
"3270"
|
||||
Agave
|
||||
AnonymousPro
|
||||
Arimo
|
||||
AurulentSansMono
|
||||
BigBlueTerminal
|
||||
BitstreamVeraSansMono
|
||||
CascadiaCode
|
||||
CodeNewRoman
|
||||
Cousine
|
||||
DaddyTimeMono
|
||||
DejaVuSansMono
|
||||
DroidSansMono
|
||||
FantasqueSansMono
|
||||
FiraCode
|
||||
FiraMono
|
||||
Go-Mono
|
||||
Gohu
|
||||
Hack
|
||||
Hasklig
|
||||
HeavyData
|
||||
Hermit
|
||||
iA-Writer
|
||||
IBMPlexMono
|
||||
Inconsolata
|
||||
Iosevka
|
||||
JetBrainsMono
|
||||
Lekton
|
||||
LiberationMono
|
||||
Meslo
|
||||
Monofur
|
||||
Monoid
|
||||
Mononoki
|
||||
MPlus
|
||||
Noto
|
||||
OpenDyslexic
|
||||
Overpass
|
||||
ProFont
|
||||
ProggyClean
|
||||
RobotoMono
|
||||
ShareTechMono
|
||||
SourceCodePro
|
||||
SpaceMono
|
||||
Terminus
|
||||
Tinos
|
||||
Ubuntu
|
||||
VictorMono
|
||||
)
|
||||
|
||||
releases_url="https://github.com/ryanoasis/nerd-fonts/releases.atom"
|
||||
|
||||
version="$(rsstail -1 -u "$releases_url" -H -l -r | sed -e '/^Title: /d' -e 's:.*/::' -e 's/^v//g' | sort -V | tail -1)"
|
||||
|
||||
echo Using version "$version"
|
||||
|
||||
dirname="$(dirname "$0")"
|
||||
echo \""$version"\" > "$dirname/version.nix"
|
||||
|
||||
base_url="https://github.com/ryanoasis/nerd-fonts/releases/download/v${version}"
|
||||
|
||||
printf '{\n' > "$dirname/shas.nix"
|
||||
|
||||
for font in "${fonts[@]}"; do
|
||||
printf '\t"%s" = "%s";\n' "$font" "$(nix-prefetch-url "${base_url}/${font}.zip")" >> "$dirname/shas.nix"
|
||||
done
|
||||
|
||||
printf '}\n' >> "$dirname/shas.nix"
|
1
pkgs/data/fonts/nerdfonts/version.nix
Normal file
1
pkgs/data/fonts/nerdfonts/version.nix
Normal file
@ -0,0 +1 @@
|
||||
"2.1.0"
|
@ -1,28 +0,0 @@
|
||||
{ lib, fetchzip }:
|
||||
|
||||
let
|
||||
version = "2.0.0";
|
||||
in fetchzip {
|
||||
name = "terminus-nerdfont-${version}";
|
||||
|
||||
url = "https://github.com/ryanoasis/nerd-fonts/releases/download/v${version}/Terminus.zip";
|
||||
|
||||
postFetch = ''
|
||||
mkdir -p $out/share/fonts/terminus-nerdfont
|
||||
unzip -j $downloadedFile -d $out/share/fonts/terminus-nerdfont
|
||||
'';
|
||||
|
||||
sha256 = "036i1qwwrb0r8hvcjf3h34w0g7mbsmngvrjic98jgikbz3i2f46c";
|
||||
|
||||
meta = with lib; {
|
||||
description = ''
|
||||
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://github.com/ryanoasis/nerd-fonts;
|
||||
license = licenses.mit;
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
@ -17808,7 +17808,9 @@ in
|
||||
|
||||
inconsolata-lgc = callPackage ../data/fonts/inconsolata/lgc.nix {};
|
||||
|
||||
inconsolata-nerdfont = callPackage ../data/fonts/inconsolata-nerdfont {};
|
||||
inconsolata-nerdfont = nerdfonts.override {
|
||||
fonts = [ "Inconsolata" ];
|
||||
};
|
||||
|
||||
input-fonts = callPackage ../data/fonts/input-fonts { };
|
||||
|
||||
@ -18212,7 +18214,9 @@ in
|
||||
|
||||
terminus_font_ttf = callPackage ../data/fonts/terminus-font-ttf { };
|
||||
|
||||
terminus-nerdfont = callPackage ../data/fonts/terminus-nerdfont { };
|
||||
terminus-nerdfont = nerdfonts.override {
|
||||
fonts = [ "Terminus" ];
|
||||
};
|
||||
|
||||
termtekst = callPackage ../misc/emulators/termtekst { };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user