diff --git a/pkgs/servers/x11/xorg/overrides.nix b/pkgs/servers/x11/xorg/overrides.nix index 092764a3d9d8..80112755e6df 100644 --- a/pkgs/servers/x11/xorg/overrides.nix +++ b/pkgs/servers/x11/xorg/overrides.nix @@ -1,7 +1,7 @@ { abiCompat ? null, stdenv, makeWrapper, fetchurl, fetchpatch, fetchFromGitLab, buildPackages, automake, autoconf, gettext, libiconv, libtool, intltool, - freetype, tradcpp, fontconfig, meson, ninja, ed, + freetype, tradcpp, fontconfig, meson, ninja, ed, fontforge, libGL, spice-protocol, zlib, libGLU, dbus, libunwind, libdrm, mesa, udev, bootstrap_cmds, bison, flex, clangStdenv, autoreconfHook, mcpp, epoxy, openssl, pkgconfig, llvm_6, python3, @@ -50,10 +50,6 @@ self: super: hardeningDisable = [ "format" ]; }); - fontbhttf = super.fontbhttf.overrideAttrs (attrs: { - meta = attrs.meta // { license = lib.licenses.unfreeRedistributable; }; - }); - fontmiscmisc = super.fontmiscmisc.overrideAttrs (attrs: { postInstall = '' @@ -848,4 +844,63 @@ self: super: --set XAPPLRESDIR ${placeholder "out"}/share/X11/app-defaults ''; }); + + # convert Type1 vector fonts to OpenType fonts + fontbitstreamtype1 = super.fontbitstreamtype1.overrideAttrs (attrs: { + nativeBuildInputs = attrs.nativeBuildInputs ++ [ fontforge ]; + + postBuild = '' + # convert Postscript (Type 1) font to otf + for i in $(find -type f -name '*.pfa' -o -name '*.pfb'); do + name=$(basename $i | cut -d. -f1) + fontforge -lang=ff -c "Open(\"$i\"); Generate(\"$name.otf\")" + done + ''; + + postInstall = '' + # install the otf fonts + fontDir="$out/lib/X11/fonts/misc/" + install -D -m 644 -t "$fontDir" *.otf + mkfontscale "$fontDir" + ''; + }); + } + +# mark some packages as unfree +// ( + let + # unfree but redistributable + redist = [ + "fontadobeutopiatype1" + "fontadobeutopia100dpi" + "fontadobeutopia75dpi" + "fontbhtype1" + "fontibmtype1" + "fontbhttf" + "fontbh100dpi" + "fontbh75dpi" + ]; + + # unfree, possibly not redistributable + unfree = [ + # no license, just a copyright notice + "fontbhlucidatypewriter100dpi" + "fontbhlucidatypewriter75dpi" + "fontdaewoomisc" + + # unclear license, "permission to use"? + "fontjismisc" + ]; + + setLicense = license: name: + super.${name}.overrideAttrs (attrs: { + meta = attrs.meta // { inherit license; }; + }); + mapNamesToAttrs = f: names: with lib; + listToAttrs (zipListsWith nameValuePair names (map f names)); + + in + mapNamesToAttrs (setLicense lib.licenses.unfreeRedistributable) redist // + mapNamesToAttrs (setLicense lib.licenses.unfree) unfree +)