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