nixos-config/pkgs/fonts/dina-psf.nix

51 lines
1.1 KiB
Nix
Raw Normal View History

2025-02-11 15:48:55 +01:00
{
pkgs,
...
}:
pkgs.stdenv.mkDerivation {
pname = "dina-psfu";
version = "1.0.0";
unpackPhase = ''
true
'';
buildInputs = with pkgs; [
2025-02-11 19:30:26 +01:00
dina-font
# ttf2psf
2025-02-11 15:48:55 +01:00
bdf2psf
2025-02-11 19:30:26 +01:00
# kbd
2025-02-11 15:48:55 +01:00
];
2025-02-11 19:30:26 +01:00
# buildPhase = ''
# # Get the base Dina otb font
# cp ${pkgs.dina-font}/share/fonts/misc/DinaMedium9.otb ./dina.otb
# # Create the character set
# cp ${pkgs.ttf2psf}/share/ttf2psf/ascii
# # Convert to psfu
# ttf2psu -g -c ${pkgs.ttf2psf}/share/ttf2psf/ -e ${pkgs.ttf2psf}/share/ttf2psf/standard.equivalents dina.otb dina.psfu.gz
# '';
2025-02-11 15:48:55 +01:00
buildPhase = ''
2025-02-11 19:30:26 +01:00
# Get the base Dina font
cp ${pkgs.dina-font.bdf}/share/fonts/misc/Dina_r400-10.bdf ./dina.bdf
2025-02-11 15:48:55 +01:00
# Set the AVERAGE_WIDTH property on the font
sed 's/STARTPROPERTIES 16/STARTPROPERTIES 17\
2025-02-11 19:30:26 +01:00
AVERAGE_WIDTH 80/' ./dina.bdf > ./dina-mod.bdf
2025-02-11 15:48:55 +01:00
# Convert the bdf to psf
bdf2psf --fb ./dina-mod.bdf \
${pkgs.bdf2psf}/share/bdf2psf/standard.equivalents \
2025-02-11 19:30:26 +01:00
${pkgs.bdf2psf}/share/bdf2psf/fontsets/Uni2.512 \
2025-02-11 15:48:55 +01:00
512 ./dina.psf
'';
installPhase = ''
2025-02-11 19:30:26 +01:00
install -Dm644 -t $out/share/consolefonts dina.psf
2025-02-11 15:48:55 +01:00
'';
}