diff --git a/pkgs/data/fonts/dina-pcf/default.nix b/pkgs/data/fonts/dina-pcf/default.nix deleted file mode 100644 index eff0c579a707..000000000000 --- a/pkgs/data/fonts/dina-pcf/default.nix +++ /dev/null @@ -1,64 +0,0 @@ -{stdenv, fetchurl, unzip, bdftopcf, mkfontdir, mkfontscale}: - -stdenv.mkDerivation { - version = "2.92"; - pname = "dina-font-pcf"; - - src = fetchurl { - url = "http://www.donationcoder.com/Software/Jibz/Dina/downloads/Dina.zip"; - sha256 = "1kq86lbxxgik82aywwhawmj80vsbz3hfhdyhicnlv9km7yjvnl8z"; - }; - - nativeBuildInputs = [ unzip bdftopcf mkfontdir mkfontscale ]; - - dontBuild = true; - patchPhase = "sed -i 's/microsoft-cp1252/ISO8859-1/' *.bdf"; - installPhase = '' - _get_font_size() { - _pt=$\{1%.bdf} - _pt=$\{_pt#*-} - echo $_pt - } - - for i in Dina_i400-*.bdf; do - bdftopcf -t -o DinaItalic$(_get_font_size $i).pcf $i - done - for i in Dina_i700-*.bdf; do - bdftopcf -t -o DinaBoldItalic$(_get_font_size $i).pcf $i - done - for i in Dina_r400-*.bdf; do - bdftopcf -t -o DinaMedium$(_get_font_size $i).pcf $i - done - for i in Dina_r700-*.bdf; do - bdftopcf -t -o DinaBold$(_get_font_size $i).pcf $i - done - gzip -n *.pcf - - fontDir="$out/share/fonts/misc" - mkdir -p "$fontDir" - mv *.pcf.gz "$fontDir" - - cd "$fontDir" - mkfontdir - mkfontscale - ''; - - preferLocalBuild = true; - - outputHashAlgo = "sha256"; - outputHashMode = "recursive"; - outputHash = "0v0qn5zwq4j1yx53ypg6w6mqx6dk8l1xix0188b0k4z3ivgnflyb"; - - meta = with stdenv.lib; { - description = "A monospace bitmap font aimed at programmers"; - longDescription = '' - Dina is a monospace bitmap font, primarily aimed at programmers. It is - relatively compact to allow a lot of code on screen, while (hopefully) - clear enough to remain readable even at high resolutions. - ''; - homepage = https://www.donationcoder.com/Software/Jibz/Dina/; - downloadPage = https://www.donationcoder.com/Software/Jibz/Dina/; - license = licenses.free; - maintainers = [ maintainers.prikhi ]; - }; -} diff --git a/pkgs/data/fonts/dina/default.nix b/pkgs/data/fonts/dina/default.nix index 0d4cd286219e..d5b709007035 100644 --- a/pkgs/data/fonts/dina/default.nix +++ b/pkgs/data/fonts/dina/default.nix @@ -1,20 +1,47 @@ -{ stdenv, fetchzip }: +{ stdenv, fetchurl, unzip +, bdftopcf, mkfontscale +}: -let +stdenv.mkDerivation { + pname = "dina-font"; version = "2.92"; -in fetchzip { - name = "dina-font-${version}"; - # `meta.homepage` has no direct download link - url = "https://github.com/ProgrammingFonts/ProgrammingFonts/archive/b15ef365146be7eef4a46979cfe157c5aeefb7c0.zip"; + src = fetchurl { + url = "http://www.donationcoder.com/Software/Jibz/Dina/downloads/Dina.zip"; + sha256 = "1kq86lbxxgik82aywwhawmj80vsbz3hfhdyhicnlv9km7yjvnl8z"; + }; - postFetch = '' - mkdir -p $out/share/fonts - unzip -j $downloadedFile '*/Dina/*.bdf' -d $out/share/fonts - chmod u-x $out/share/fonts/* + nativeBuildInputs = + [ unzip bdftopcf mkfontscale ]; + + patchPhase = "sed -i 's/microsoft-cp1252/ISO8859-1/' *.bdf"; + + buildPhase = '' + newName() { + test "''${1:5:1}" = i && _it=Italic || _it= + case ''${1:6:3} in + 400) test -z $it && _weight=Medium ;; + 700) _weight=Bold ;; + esac + _pt=''${1%.bdf} + _pt=''${_pt#*-} + echo "Dina$_weight$_it$_pt" + } + + # convert bdf fonts to pcf + for i in *.bdf; do + bdftopcf -t -o $(newName "$i").pcf "$i" + done + gzip -n -9 *.pcf ''; - sha256 = "02a6hqbq18sw69npylfskriqhvj1nsk65hjjyd05nl913ycc6jl7"; + installPhase = '' + install -D -m 644 -t "$out/share/fonts/misc" *.pcf.gz + install -D -m 644 -t "$bdf/share/fonts/misc" *.bdf + mkfontdir "$out/share/fonts/misc" + ''; + + outputs = [ "out" "bdf" ]; meta = with stdenv.lib; { description = "A monospace bitmap font aimed at programmers"; diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 6b4fb1f9f746..f27391ff9049 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -542,6 +542,9 @@ mapAliases ({ # added 2020-01-10 tor-browser-unwrapped = throw "tor-browser-unwrapped was removed because it was out of date and inadequately maintained. Please use tor-browser-bundle-bin instead. See #77452."; + # added 2020-02-09 + dina-font-pcf = dina-font; + /* Cleanup before 20.09 */ llvm_4 = throw '' The LLVM versions 3.5, 3.9 and 4.0 have been removed in NixOS 20.03 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c0c475483078..60094116a049 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17378,9 +17378,8 @@ in paths = [ dejavu_fonts.out ]; }; - dina-font = callPackage ../data/fonts/dina { }; - - dina-font-pcf = callPackage ../data/fonts/dina-pcf { }; + dina-font = callPackage ../data/fonts/dina + { inherit (buildPackages.xorg) mkfontscale; }; dns-root-data = callPackage ../data/misc/dns-root-data { };