Merge pull request #96697 from hir12111/fix-font-dir
fontdir: Consider scalable fonts in index fonts.dir
This commit is contained in:
commit
04670f8b3d
@ -63,6 +63,14 @@
|
|||||||
<literal>systemd-journal2gelf</literal> no longer parses json and expects the receiving system to handle it. How to achieve this with Graylog is described in this <link xlink:href="https://github.com/parse-nl/SystemdJournal2Gelf/issues/10">GitHub issue</link>.
|
<literal>systemd-journal2gelf</literal> no longer parses json and expects the receiving system to handle it. How to achieve this with Graylog is described in this <link xlink:href="https://github.com/parse-nl/SystemdJournal2Gelf/issues/10">GitHub issue</link>.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
The option <option>fonts.enableFontDir</option> has been renamed to
|
||||||
|
<xref linkend="opt-fonts.fontDir.enable"/>. The path of font directory
|
||||||
|
has also been changed to <literal>/run/current-system/sw/share/X11/fonts</literal>,
|
||||||
|
for consistency with other X11 resources.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
@ -4,15 +4,19 @@ with lib;
|
|||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
|
cfg = config.fonts.fontDir;
|
||||||
|
|
||||||
x11Fonts = pkgs.runCommand "X11-fonts" { preferLocalBuild = true; } ''
|
x11Fonts = pkgs.runCommand "X11-fonts" { preferLocalBuild = true; } ''
|
||||||
mkdir -p "$out/share/X11-fonts"
|
mkdir -p "$out/share/X11/fonts"
|
||||||
find ${toString config.fonts.fonts} \
|
font_regexp='.*\.\(ttf\|otf\|pcf\|pfa\|pfb\|bdf\)\(\.gz\)?'
|
||||||
\( -name fonts.dir -o -name '*.ttf' -o -name '*.otf' \) \
|
find ${toString config.fonts.fonts} -regex "$font_regexp" \
|
||||||
-exec ln -sf -t "$out/share/X11-fonts" '{}' \;
|
-exec ln -sf -t "$out/share/X11/fonts" '{}' \;
|
||||||
cd "$out/share/X11-fonts"
|
cd "$out/share/X11/fonts"
|
||||||
rm -f fonts.dir fonts.scale fonts.alias
|
${optionalString cfg.decompressFonts ''
|
||||||
${pkgs.xorg.mkfontdir}/bin/mkfontdir
|
${pkgs.gzip}/bin/gunzip -f *.gz
|
||||||
|
''}
|
||||||
${pkgs.xorg.mkfontscale}/bin/mkfontscale
|
${pkgs.xorg.mkfontscale}/bin/mkfontscale
|
||||||
|
${pkgs.xorg.mkfontdir}/bin/mkfontdir
|
||||||
cat $(find ${pkgs.xorg.fontalias}/ -name fonts.alias) >fonts.alias
|
cat $(find ${pkgs.xorg.fontalias}/ -name fonts.alias) >fonts.alias
|
||||||
'';
|
'';
|
||||||
|
|
||||||
@ -21,28 +25,43 @@ in
|
|||||||
{
|
{
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
fonts.fontDir = {
|
||||||
|
|
||||||
fonts = {
|
enable = mkOption {
|
||||||
|
|
||||||
enableFontDir = mkOption {
|
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
Whether to create a directory with links to all fonts in
|
Whether to create a directory with links to all fonts in
|
||||||
<filename>/run/current-system/sw/share/X11-fonts</filename>.
|
<filename>/run/current-system/sw/share/X11/fonts</filename>.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
decompressFonts = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = config.programs.xwayland.enable;
|
||||||
|
description = ''
|
||||||
|
Whether to decompress fonts in
|
||||||
|
<filename>/run/current-system/sw/share/X11/fonts</filename>.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf config.fonts.enableFontDir {
|
config = mkIf cfg.enable {
|
||||||
|
|
||||||
|
# This is enough to make a symlink because the xserver
|
||||||
|
# module already links all /share/X11 paths.
|
||||||
environment.systemPackages = [ x11Fonts ];
|
environment.systemPackages = [ x11Fonts ];
|
||||||
|
|
||||||
environment.pathsToLink = [ "/share/X11-fonts" ];
|
services.xserver.filesSection = ''
|
||||||
|
FontPath "${x11Fonts}/share/X11/fonts"
|
||||||
|
'';
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
(mkRenamedOptionModule [ "fonts" "enableFontDir" ] [ "fonts" "fontDir" "enable" ])
|
||||||
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -175,6 +175,7 @@
|
|||||||
./programs/xfs_quota.nix
|
./programs/xfs_quota.nix
|
||||||
./programs/xonsh.nix
|
./programs/xonsh.nix
|
||||||
./programs/xss-lock.nix
|
./programs/xss-lock.nix
|
||||||
|
./programs/xwayland.nix
|
||||||
./programs/yabar.nix
|
./programs/yabar.nix
|
||||||
./programs/zmap.nix
|
./programs/zmap.nix
|
||||||
./programs/zsh/oh-my-zsh.nix
|
./programs/zsh/oh-my-zsh.nix
|
||||||
|
@ -86,8 +86,7 @@ in {
|
|||||||
extraPackages = mkOption {
|
extraPackages = mkOption {
|
||||||
type = with types; listOf package;
|
type = with types; listOf package;
|
||||||
default = with pkgs; [
|
default = with pkgs; [
|
||||||
swaylock swayidle
|
swaylock swayidle alacritty dmenu
|
||||||
xwayland alacritty dmenu
|
|
||||||
rxvt-unicode # For backward compatibility (old default terminal)
|
rxvt-unicode # For backward compatibility (old default terminal)
|
||||||
];
|
];
|
||||||
defaultText = literalExample ''
|
defaultText = literalExample ''
|
||||||
@ -104,6 +103,7 @@ in {
|
|||||||
Extra packages to be installed system wide.
|
Extra packages to be installed system wide.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
@ -130,6 +130,7 @@ in {
|
|||||||
programs.dconf.enable = mkDefault true;
|
programs.dconf.enable = mkDefault true;
|
||||||
# To make a Sway session available if a display manager like SDDM is enabled:
|
# To make a Sway session available if a display manager like SDDM is enabled:
|
||||||
services.xserver.displayManager.sessionPackages = [ swayPackage ];
|
services.xserver.displayManager.sessionPackages = [ swayPackage ];
|
||||||
|
programs.xwayland.enable = mkDefault true;
|
||||||
};
|
};
|
||||||
|
|
||||||
meta.maintainers = with lib.maintainers; [ gnidorah primeos colemickens ];
|
meta.maintainers = with lib.maintainers; [ gnidorah primeos colemickens ];
|
||||||
|
45
nixos/modules/programs/xwayland.nix
Normal file
45
nixos/modules/programs/xwayland.nix
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.programs.xwayland;
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
options.programs.xwayland = {
|
||||||
|
|
||||||
|
enable = mkEnableOption ''
|
||||||
|
Xwayland X server allows running X programs on a Wayland compositor.
|
||||||
|
'';
|
||||||
|
|
||||||
|
defaultFontPath = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = optionalString config.fonts.fontDir.enable
|
||||||
|
"/run/current-system/sw/share/X11/fonts";
|
||||||
|
description = ''
|
||||||
|
Default font path. Setting this option causes Xwayland to be rebuilt.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
description = "The Xwayland package";
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
|
||||||
|
# Needed by some applications for fonts and default settings
|
||||||
|
environment.pathsToLink = [ "/share/X11" ];
|
||||||
|
|
||||||
|
environment.systemPackages = [ cfg.package ];
|
||||||
|
|
||||||
|
programs.xwayland.package = pkgs.xwayland.override (oldArgs: {
|
||||||
|
inherit (cfg) defaultFontPath;
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
@ -136,6 +136,7 @@ let
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo '${cfg.filesSection}' >> $out
|
||||||
echo 'EndSection' >> $out
|
echo 'EndSection' >> $out
|
||||||
|
|
||||||
echo "$config" >> $out
|
echo "$config" >> $out
|
||||||
@ -366,6 +367,13 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
filesSection = mkOption {
|
||||||
|
type = types.lines;
|
||||||
|
default = "";
|
||||||
|
example = ''FontPath "/path/to/my/fonts"'';
|
||||||
|
description = "Contents of the first <literal>Files</literal> section of the X server configuration file.";
|
||||||
|
};
|
||||||
|
|
||||||
deviceSection = mkOption {
|
deviceSection = mkOption {
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
default = "";
|
default = "";
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
{ stdenv, wayland, wayland-protocols, xorgserver, xkbcomp, xkeyboard_config, epoxy, libxslt, libunwind, makeWrapper, egl-wayland }:
|
{ stdenv, wayland, wayland-protocols, xorgserver, xkbcomp, xkeyboard_config
|
||||||
|
, epoxy, libxslt, libunwind, makeWrapper, egl-wayland
|
||||||
|
, defaultFontPath ? "" }:
|
||||||
|
|
||||||
with stdenv.lib;
|
with stdenv.lib;
|
||||||
|
|
||||||
@ -19,7 +21,7 @@ xorgserver.overrideAttrs (oldAttrs: {
|
|||||||
"--disable-xquartz"
|
"--disable-xquartz"
|
||||||
"--disable-xwin"
|
"--disable-xwin"
|
||||||
"--enable-glamor"
|
"--enable-glamor"
|
||||||
"--with-default-font-path="
|
"--with-default-font-path=${defaultFontPath}"
|
||||||
"--with-xkb-bin-directory=${xkbcomp}/bin"
|
"--with-xkb-bin-directory=${xkbcomp}/bin"
|
||||||
"--with-xkb-path=${xkeyboard_config}/etc/X11/xkb"
|
"--with-xkb-path=${xkeyboard_config}/etc/X11/xkb"
|
||||||
"--with-xkb-output=$(out)/share/X11/xkb/compiled"
|
"--with-xkb-output=$(out)/share/X11/xkb/compiled"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user