From 1fdd3921a2b08a28c850e9da88f1ed67dd07b5cb Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Tue, 1 Sep 2020 10:37:11 +0200 Subject: nixos/xserver: add option to configure the "Files" section --- nixos/modules/services/x11/xserver.nix | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'nixos/modules/services/x11/xserver.nix') diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix index 0552095ba95..c8335b69769 100644 --- a/nixos/modules/services/x11/xserver.nix +++ b/nixos/modules/services/x11/xserver.nix @@ -136,6 +136,7 @@ let fi done + echo '${cfg.filesSection}' >> $out echo 'EndSection' >> $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 Files section of the X server configuration file."; + }; + deviceSection = mkOption { type = types.lines; default = ""; -- cgit 1.4.1 From eda7e23ea4c276e593bb399e552a5701a6e725f1 Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Tue, 1 Sep 2020 10:38:59 +0200 Subject: nixos/fontdir: add the directory to the xserver font paths --- nixos/modules/config/fonts/fontdir.nix | 14 +++++++++----- nixos/modules/services/x11/xserver.nix | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'nixos/modules/services/x11/xserver.nix') 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 { -- cgit 1.4.1