about summary refs log tree commit diff
path: root/nixos/modules/services/misc/dictd.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/services/misc/dictd.nix')
-rw-r--r--nixos/modules/services/misc/dictd.nix20
1 files changed, 10 insertions, 10 deletions
diff --git a/nixos/modules/services/misc/dictd.nix b/nixos/modules/services/misc/dictd.nix
index 8cb51bb0b7a7f..b11a87f289051 100644
--- a/nixos/modules/services/misc/dictd.nix
+++ b/nixos/modules/services/misc/dictd.nix
@@ -1,7 +1,4 @@
 { config, lib, pkgs, ... }:
-
-with lib;
-
 let
   cfg = config.services.dictd;
 in
@@ -14,19 +11,19 @@ in
 
     services.dictd = {
 
-      enable = mkOption {
-        type = types.bool;
+      enable = lib.mkOption {
+        type = lib.types.bool;
         default = false;
         description = ''
           Whether to enable the DICT.org dictionary server.
         '';
       };
 
-      DBs = mkOption {
-        type = types.listOf types.package;
+      DBs = lib.mkOption {
+        type = lib.types.listOf lib.types.package;
         default = with pkgs.dictdDBs; [ wiktionary wordnet ];
-        defaultText = literalExpression "with pkgs.dictdDBs; [ wiktionary wordnet ]";
-        example = literalExpression "[ pkgs.dictdDBs.nld2eng ]";
+        defaultText = lib.literalExpression "with pkgs.dictdDBs; [ wiktionary wordnet ]";
+        example = lib.literalExpression "[ pkgs.dictdDBs.nld2eng ]";
         description = "List of databases to make available.";
       };
 
@@ -40,7 +37,7 @@ in
   config = let dictdb = pkgs.dictDBCollector { dictlist = map (x: {
                name = x.name;
                filename = x; } ) cfg.DBs; };
-  in mkIf cfg.enable {
+  in lib.mkIf cfg.enable {
 
     # get the command line client on system path to make some use of the service
     environment.systemPackages = [ pkgs.dict ];
@@ -62,6 +59,9 @@ in
       description = "DICT.org Dictionary Server";
       wantedBy = [ "multi-user.target" ];
       environment = { LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive"; };
+      # Work around the fact that dictd doesn't handle SIGTERM; it terminates
+      # with code 143 instead of exiting with code 0.
+      serviceConfig.SuccessExitStatus = [ 143 ];
       serviceConfig.Type = "forking";
       script = "${pkgs.dict}/sbin/dictd -s -c ${dictdb}/share/dictd/dictd.conf --locale en_US.UTF-8";
     };