Files
whc ad9bf8035e 整理 NixOS 配置:面向 i7-12700F + RTX 4060 的模块化桌面配置
从当前 /etc/nixos 拆出 common/plasma/中文/应用/打印模块,新增 NVIDIA 独显支持,并去掉原机硬件 UUID。
2026-09-19 15:50:30 +08:00

52 lines
1.4 KiB
Nix
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{ pkgs, ... }:
let
hp-uld = pkgs.callPackage ../pkgs/hp-uld-driver.nix { };
cjkSans = "${pkgs.noto-fonts-cjk-sans}/share/fonts/opentype/noto-cjk/NotoSansCJK-VF.otf.ttc";
gsLib = pkgs.runCommand "gs-cjk-lib" { } ''
mkdir -p $out
cat > $out/cidfmap <<CID
% Ghostscript CJK CID map for missing embedded fonts in PDF/PS
/Adobe-GB1 << /FileType /TrueType /Path (${cjkSans}) /SubfontID 0 /CSI ([Adobe-GB1] 0) >> ;
/Adobe-CNS1 << /FileType /TrueType /Path (${cjkSans}) /SubfontID 1 /CSI ([Adobe-CNS1] 0) >> ;
CID
'';
in
{
services.printing.enable = true;
# HP Laser MFP 13x 需官方 ULD(rastertospl)
services.printing.drivers = [ hp-uld ];
fonts.packages = with pkgs; [ arphic-uming ];
fonts.fontconfig.localConf = ''
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
<alias binding="same">
<family>ARPLUmingCN</family>
<prefer>
<family>AR PL UMing CN</family>
<family>Noto Serif CJK SC</family>
</prefer>
</alias>
<alias binding="same">
<family>NotoSansMonoCJKSC</family>
<prefer>
<family>Noto Sans Mono CJK SC</family>
</prefer>
</alias>
</fontconfig>
'';
systemd.services.cups.serviceConfig.Environment = [
"FONTCONFIG_FILE=/etc/fonts/fonts.conf"
"FONTCONFIG_PATH=/etc/fonts"
"GS_LIB=${gsLib}"
];
services.printing.extraFilesConf = ''
SetEnv GS_LIB ${gsLib}
'';
}