diff --git a/nixos/modules/config/fonts/fontdir.nix b/nixos/modules/config/fonts/fontdir.nix
index 098038fa6d2..52fd2677d13 100644
--- a/nixos/modules/config/fonts/fontdir.nix
+++ b/nixos/modules/config/fonts/fontdir.nix
@@ -5,11 +5,11 @@ with lib;
let
x11Fonts = pkgs.runCommand "X11-fonts" { preferLocalBuild = true; } ''
- mkdir -p "$out/share/X11-fonts"
+ mkdir -p "$out/share/X11/fonts"
font_regexp='.*\.\(ttf\|otf\|pcf\|pfa\|pfb\|bdf\)\(\.gz\)?'
find ${toString config.fonts.fonts} -regex "$font_regexp" \
- -exec ln -sf -t "$out/share/X11-fonts" '{}' \;
- cd "$out/share/X11-fonts"
+ -exec ln -sf -t "$out/share/X11/fonts" '{}' \;
+ cd "$out/share/X11/fonts"
${pkgs.xorg.mkfontscale}/bin/mkfontscale
${pkgs.xorg.mkfontdir}/bin/mkfontdir
cat $(find ${pkgs.xorg.fontalias}/ -name fonts.alias) >fonts.alias
@@ -28,7 +28,7 @@ in
default = false;
description = ''
Whether to create a directory with links to all fonts in
- /run/current-system/sw/share/X11-fonts.
+ /run/current-system/sw/share/X11/fonts.
'';
};
@@ -38,9 +38,13 @@ in
config = mkIf config.fonts.enableFontDir {
+ # This is enough to make a symlink because the xserver
+ # module already links all /share/X11 paths.
environment.systemPackages = [ x11Fonts ];
- environment.pathsToLink = [ "/share/X11-fonts" ];
+ services.xserver.filesSection = ''
+ FontPath "${x11Fonts}/share/X11/fonts"
+ '';
};
diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix
index c8335b69769..8223c1f1e67 100644
--- a/nixos/modules/services/x11/xserver.nix
+++ b/nixos/modules/services/x11/xserver.nix
@@ -371,7 +371,7 @@ in
type = types.lines;
default = "";
example = ''FontPath "/path/to/my/fonts"'';
- description = "Contents of the first Files section of the X server configuration file.";
+ description = "Contents of the first Files section of the X server configuration file.";
};
deviceSection = mkOption {