about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorPetr Rockai <me@mornfall.net>2012-10-27 23:11:54 +0200
committerPetr Rockai <me@mornfall.net>2014-01-25 16:35:02 +0100
commit66db1b3a646e73e15458da4ff98347d424454b88 (patch)
tree0a6232cfb7bf745e4700579634cfaa1946b50b9b /nixos
parented5bd26574c43246920fdf814e997b86c7b50fff (diff)
downloadnixlib-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')
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/services/misc/dictd.nix61
2 files changed, 62 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 442edd8029de..aa4bada8b28b 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -116,6 +116,7 @@
   ./services/mail/spamassassin.nix
   ./services/misc/autofs.nix
   ./services/misc/cgminer.nix
+  ./services/misc/dictd.nix
   ./services/misc/disnix.nix
   ./services/misc/felix.nix
   ./services/misc/folding-at-home.nix
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";
+      };
+  };
+
+}