mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-12-21 19:24:15 +00:00
add custom nerdfont package
This commit is contained in:
parent
497dd7036f
commit
16cd165ae6
3 changed files with 59 additions and 7 deletions
|
@ -8,13 +8,7 @@ with lib;
|
||||||
security-tools = true;
|
security-tools = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
fonts.fonts = [
|
fonts.fonts = [ pkgs.bck-nerdfont ];
|
||||||
# vscode: "DejaVuSansMono Nerd Font" (size 16)
|
|
||||||
# gnome-terminal: "DejaVu Sans Mono, Inconsolata for Powerline Medium 12"
|
|
||||||
# gnome-terminal setting (dconf): /org/gnome/terminal/legacy/profiles/.../font
|
|
||||||
pkgs.powerline-fonts
|
|
||||||
(pkgs.nerdfonts.override { fonts = [ "DejaVuSansMono" ]; })
|
|
||||||
];
|
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
brave
|
brave
|
||||||
|
|
57
pkgs/bck-nerdfont.nix
Normal file
57
pkgs/bck-nerdfont.nix
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
{ stdenv
|
||||||
|
, lib
|
||||||
|
, dejavu_fonts
|
||||||
|
, fetchFromGitHub
|
||||||
|
, python3
|
||||||
|
, writeScript
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
py = python3.withPackages (p: [ p.fontforge ]);
|
||||||
|
|
||||||
|
# Stick a rectangle on the left edge of the
|
||||||
|
# powerline symbol to avoid anti-aliasing artifacts
|
||||||
|
postprocess = writeScript "postprocess.py" ''
|
||||||
|
#!${py}/bin/python
|
||||||
|
import fontforge, psMat, sys, os
|
||||||
|
f = fontforge.open(sys.argv[1])
|
||||||
|
glyph = f[0xE0B0]
|
||||||
|
bb = glyph.boundingBox()
|
||||||
|
pen = glyph.glyphPen(replace=False)
|
||||||
|
pen.moveTo(bb[0],bb[1])
|
||||||
|
pen.lineTo(bb[0],bb[3])
|
||||||
|
pen.lineTo(bb[0]-150,bb[3])
|
||||||
|
pen.lineTo(bb[0]-150,bb[1])
|
||||||
|
pen.closePath()
|
||||||
|
os.unlink(sys.argv[1])
|
||||||
|
f.generate(sys.argv[1])
|
||||||
|
'';
|
||||||
|
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "bck-nerdfont";
|
||||||
|
|
||||||
|
dontUnpack = true;
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "ryanoasis";
|
||||||
|
repo = "nerd-fonts";
|
||||||
|
rev = "v2.1.0";
|
||||||
|
sha256 = "j0cLZHOLyoItdvLOQVQVurY3ARtndv0FZTynaYJPR9E=";
|
||||||
|
};
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
# Either Octicons or FontAwesome are required. Take your pick.
|
||||||
|
# They cause the fontlinux characters to move to the correct slots.
|
||||||
|
# (see fontlinuxExactEncodingPosition)
|
||||||
|
find ${dejavu_fonts}/share/fonts/truetype -name 'DejaVuSansMono*' -print0 |
|
||||||
|
xargs -0n1 ${py}/bin/python $src/font-patcher \
|
||||||
|
--fontlinux --octicons --powerline \
|
||||||
|
--postprocess ${postprocess}
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/share/fonts/truetype
|
||||||
|
cp -v *.ttf $out/share/fonts/truetype/
|
||||||
|
'';
|
||||||
|
}
|
|
@ -9,6 +9,7 @@ let
|
||||||
in
|
in
|
||||||
rec
|
rec
|
||||||
{
|
{
|
||||||
|
bck-nerdfont = pkg ./bck-nerdfont.nix { };
|
||||||
binaryninja = pkg ./binary-ninja-personal { };
|
binaryninja = pkg ./binary-ninja-personal { };
|
||||||
commander-x16 = pkg ./commander-x16 { };
|
commander-x16 = pkg ./commander-x16 { };
|
||||||
gef = pkg ./gef { };
|
gef = pkg ./gef { };
|
||||||
|
|
Loading…
Reference in a new issue