diff --git a/modules/profiles/desktop.nix b/modules/profiles/desktop.nix index 7ff10ab..9a364bf 100644 --- a/modules/profiles/desktop.nix +++ b/modules/profiles/desktop.nix @@ -8,13 +8,7 @@ with lib; security-tools = true; }; - fonts.fonts = [ - # 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" ]; }) - ]; + fonts.fonts = [ pkgs.bck-nerdfont ]; environment.systemPackages = with pkgs; [ brave diff --git a/pkgs/bck-nerdfont.nix b/pkgs/bck-nerdfont.nix new file mode 100644 index 0000000..c415885 --- /dev/null +++ b/pkgs/bck-nerdfont.nix @@ -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/ + ''; +} diff --git a/pkgs/default.nix b/pkgs/default.nix index 7f63bae..ace0b61 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -9,6 +9,7 @@ let in rec { + bck-nerdfont = pkg ./bck-nerdfont.nix { }; binaryninja = pkg ./binary-ninja-personal { }; commander-x16 = pkg ./commander-x16 { }; gef = pkg ./gef { };