dotfiles/pkgs/fonts/dina-psf.nix

38 lines
749 B
Nix
Raw Normal View History

2025-02-11 14:48:55 +00:00
{
pkgs,
...
}:
pkgs.stdenv.mkDerivation {
pname = "dina-psfu";
version = "1.0.0";
unpackPhase = ''
true
'';
buildInputs = with pkgs; [
2025-02-11 18:30:26 +00:00
dina-font
2025-02-11 14:48:55 +00:00
bdf2psf
];
buildPhase = ''
2025-02-11 18:30:26 +00:00
# Get the base Dina font
2025-02-11 18:31:06 +00:00
cp ${pkgs.dina-font.bdf}/share/fonts/misc/Dina_r400-9.bdf ./dina.bdf
2025-02-11 14:48:55 +00:00
# Set the AVERAGE_WIDTH property on the font
sed 's/STARTPROPERTIES 16/STARTPROPERTIES 17\
2025-02-11 18:31:06 +00:00
AVERAGE_WIDTH 70/' ./dina.bdf > ./dina-mod.bdf
2025-02-11 14:48:55 +00:00
# Convert the bdf to psf
bdf2psf --fb ./dina-mod.bdf \
${pkgs.bdf2psf}/share/bdf2psf/standard.equivalents \
2025-02-11 18:30:26 +00:00
${pkgs.bdf2psf}/share/bdf2psf/fontsets/Uni2.512 \
2025-02-11 14:48:55 +00:00
512 ./dina.psf
'';
installPhase = ''
2025-02-11 18:30:26 +00:00
install -Dm644 -t $out/share/consolefonts dina.psf
2025-02-11 14:48:55 +00:00
'';
}