diff options
author | Petr Rockai <me@mornfall.net> | 2012-10-27 23:11:54 +0200 |
---|---|---|
committer | Petr Rockai <me@mornfall.net> | 2014-01-25 16:35:02 +0100 |
commit | 66db1b3a646e73e15458da4ff98347d424454b88 (patch) | |
tree | 0a6232cfb7bf745e4700579634cfaa1946b50b9b /nixos/modules/services/misc/dictd.nix | |
parent | ed5bd26574c43246920fdf814e997b86c7b50fff (diff) | |
download | nixlib-66db1b3a646e73e15458da4ff98347d424454b88.tar nixlib-66db1b3a646e73e15458da4ff98347d424454b88.tar.gz nixlib-66db1b3a646e73e15458da4ff98347d424454b88.tar.bz2 nixlib-66db1b3a646e73e15458da4ff98347d424454b88.tar.lz nixlib-66db1b3a646e73e15458da4ff98347d424454b88.tar.xz nixlib-66db1b3a646e73e15458da4ff98347d424454b88.tar.zst nixlib-66db1b3a646e73e15458da4ff98347d424454b88.zip |
nixos: Add a dictd service.
Diffstat (limited to 'nixos/modules/services/misc/dictd.nix')
-rw-r--r-- | nixos/modules/services/misc/dictd.nix | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/nixos/modules/services/misc/dictd.nix b/nixos/modules/services/misc/dictd.nix new file mode 100644 index 000000000000..b84fbb3e1281 --- /dev/null +++ b/nixos/modules/services/misc/dictd.nix @@ -0,0 +1,61 @@ +{ config, pkgs, ... }: + +with pkgs.lib; + +{ + + ###### interface + + options = { + + services.dictd = { + + enable = mkOption { + default = false; + description = '' + Whether to enable the DICT.org dictionary server. + ''; + }; + + DBs = mkOption { + default = []; + # example = [ pkgs.dictDBs.nld2eng ]; + description = ''List of databases to make available.''; + }; + + }; + + }; + + + ###### implementation + + config = let dictdb = pkgs.dictDBCollector { dictlist = map (x: { + name = x.name; + filename = x; } ) config.services.dictd.DBs; }; + in mkIf config.services.dictd.enable { + + # get the command line client on system path to make some use of the service + environment.systemPackages = [ pkgs.dict ]; + + users.extraUsers = singleton + { name = "dictd"; + group = "dictd"; + description = "DICT.org dictd server"; + home = "${dictdb}/share/dictd"; + }; + + users.extraGroups = singleton + { name = "dictd"; + }; + + jobs.dictd = + { description = "DICT.org Dictionary Server"; + startOn = "startup"; + environment = { LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive"; }; + daemonType = "fork"; + exec = "${pkgs.dict}/sbin/dictd -s -c ${dictdb}/share/dictd/dictd.conf --locale en_US.UTF-8"; + }; + }; + +} |