1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7
8with lib;
9
10let
11
12 configFile = ./xfs.conf;
13
14in
15
16{
17
18 ###### interface
19
20 options = {
21
22 services.xfs = {
23
24 enable = mkOption {
25 type = types.bool;
26 default = false;
27 description = "Whether to enable the X Font Server.";
28 };
29
30 };
31
32 };
33
34 ###### implementation
35
36 config = mkIf config.services.xfs.enable {
37 assertions = singleton {
38 assertion = config.fonts.enableFontDir;
39 message = "Please enable fonts.enableFontDir to use the X Font Server.";
40 };
41
42 systemd.services.xfs = {
43 description = "X Font Server";
44 after = [ "network.target" ];
45 wantedBy = [ "multi-user.target" ];
46 path = [ pkgs.xorg.xfs ];
47 script = "xfs -config ${configFile}";
48 };
49 };
50}