1 { config, lib, pkgs, ... }:
3 cfg = config.services.dictd;
14 enable = lib.mkOption {
15 type = lib.types.bool;
18 Whether to enable the DICT.org dictionary server.
23 type = lib.types.listOf lib.types.package;
24 default = with pkgs.dictdDBs; [ wiktionary wordnet ];
25 defaultText = lib.literalExpression "with pkgs.dictdDBs; [ wiktionary wordnet ]";
26 example = lib.literalExpression "[ pkgs.dictdDBs.nld2eng ]";
27 description = "List of databases to make available.";
37 config = let dictdb = pkgs.dictDBCollector { dictlist = map (x: {
39 filename = x; } ) cfg.DBs; };
40 in lib.mkIf cfg.enable {
42 # get the command line client on system path to make some use of the service
43 environment.systemPackages = [ pkgs.dict ];
45 environment.etc."dict.conf".text = ''
51 description = "DICT.org dictd server";
52 home = "${dictdb}/share/dictd";
53 uid = config.ids.uids.dictd;
56 users.groups.dictd.gid = config.ids.gids.dictd;
58 systemd.services.dictd = {
59 description = "DICT.org Dictionary Server";
60 wantedBy = [ "multi-user.target" ];
61 environment = { LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive"; };
62 # Work around the fact that dictd doesn't handle SIGTERM; it terminates
63 # with code 143 instead of exiting with code 0.
64 serviceConfig.SuccessExitStatus = [ 143 ];
65 serviceConfig.Type = "forking";
66 script = "${pkgs.dict}/sbin/dictd -s -c ${dictdb}/share/dictd/dictd.conf --locale en_US.UTF-8";