about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/mail/opensmtpd.nix2
-rw-r--r--nixos/modules/services/misc/dictd.nix10
-rw-r--r--nixos/modules/services/misc/matrix-synapse.nix30
-rw-r--r--nixos/tests/mpich.nix41
-rwxr-xr-xnixos/tests/test-config-examples.sh14
5 files changed, 25 insertions, 72 deletions
diff --git a/nixos/modules/services/mail/opensmtpd.nix b/nixos/modules/services/mail/opensmtpd.nix
index 5856b4697553..53acdba42457 100644
--- a/nixos/modules/services/mail/opensmtpd.nix
+++ b/nixos/modules/services/mail/opensmtpd.nix
@@ -115,7 +115,7 @@ in {
         chown smtpq.root /var/spool/smtpd/purge
         chmod 700 /var/spool/smtpd/purge
       '';
-      serviceConfig.ExecStart = "${opensmtpd}/sbin/smtpd -d -f ${conf} ${args}";
+      serviceConfig.ExecStart = "${pkgs.opensmtpd}/sbin/smtpd -d -f ${conf} ${args}";
       environment.OPENSMTPD_PROC_PATH = "${procEnv}/libexec/opensmtpd";
     };
 
diff --git a/nixos/modules/services/misc/dictd.nix b/nixos/modules/services/misc/dictd.nix
index ef744439c3d6..24dca15dd913 100644
--- a/nixos/modules/services/misc/dictd.nix
+++ b/nixos/modules/services/misc/dictd.nix
@@ -2,6 +2,10 @@
 
 with lib;
 
+let
+  cfg = config.services.dictd;
+in
+
 {
 
   ###### interface
@@ -20,7 +24,7 @@ with lib;
 
       DBs = mkOption {
         type = types.listOf types.package;
-        default = [];
+        default = with pkgs.dictdDBs; [ wiktionary wordnet ];
         example = [ pkgs.dictdDBs.nld2eng ];
         description = ''List of databases to make available.'';
       };
@@ -34,8 +38,8 @@ with lib;
 
   config = let dictdb = pkgs.dictDBCollector { dictlist = map (x: {
                name = x.name;
-               filename = x; } ) config.services.dictd.DBs; };
-  in mkIf config.services.dictd.enable {
+               filename = x; } ) cfg.DBs; };
+  in mkIf cfg.enable {
 
     # get the command line client on system path to make some use of the service
     environment.systemPackages = [ pkgs.dict ];
diff --git a/nixos/modules/services/misc/matrix-synapse.nix b/nixos/modules/services/misc/matrix-synapse.nix
index 4145f8fa957a..277fc9a39022 100644
--- a/nixos/modules/services/misc/matrix-synapse.nix
+++ b/nixos/modules/services/misc/matrix-synapse.nix
@@ -9,11 +9,15 @@ let
   mkListener = l: ''{port: ${toString l.port}, bind_address: "${l.bind_address}", type: ${l.type}, tls: ${fromBool l.tls}, x_forwarded: ${fromBool l.x_forwarded}, resources: [${concatStringsSep "," (map mkResource l.resources)}]}'';
   fromBool = x: if x then "true" else "false";
   configFile = pkgs.writeText "homeserver.yaml" ''
+${optionalString (cfg.tls_certificate_path != null) ''
 tls_certificate_path: "${cfg.tls_certificate_path}"
+''}
 ${optionalString (cfg.tls_private_key_path != null) ''
 tls_private_key_path: "${cfg.tls_private_key_path}"
 ''}
+${optionalString (cfg.tls_dh_params_path != null) ''
 tls_dh_params_path: "${cfg.tls_dh_params_path}"
+''}
 no_tls: ${fromBool cfg.no_tls}
 ${optionalString (cfg.bind_port != null) ''
 bind_port: ${toString cfg.bind_port}
@@ -146,8 +150,9 @@ in {
         '';
       };
       tls_certificate_path = mkOption {
-        type = types.str;
-        default = "/var/lib/matrix-synapse/homeserver.tls.crt";
+        type = types.nullOr types.str;
+        default = null;
+        example = "/var/lib/matrix-synapse/homeserver.tls.crt";
         description = ''
           PEM encoded X509 certificate for TLS.
           You can replace the self-signed certificate that synapse
@@ -158,16 +163,17 @@ in {
       };
       tls_private_key_path = mkOption {
         type = types.nullOr types.str;
-        default = "/var/lib/matrix-synapse/homeserver.tls.key";
-        example = null;
+        default = null;
+        example = "/var/lib/matrix-synapse/homeserver.tls.key";
         description = ''
           PEM encoded private key for TLS. Specify null if synapse is not
           speaking TLS directly.
         '';
       };
       tls_dh_params_path = mkOption {
-        type = types.str;
-        default = "/var/lib/matrix-synapse/homeserver.tls.dh";
+        type = types.nullOr types.str;
+        default = null;
+        example = "/var/lib/matrix-synapse/homeserver.tls.dh";
         description = ''
           PEM dh parameters for ephemeral keys
         '';
@@ -557,12 +563,10 @@ in {
       after = [ "network.target" ];
       wantedBy = [ "multi-user.target" ];
       preStart = ''
-        if ! test -e /var/lib/matrix-synapse; then
-          mkdir -p /var/lib/matrix-synapse
-          chmod 700 /var/lib/matrix-synapse
-          chown -R matrix-synapse:matrix-synapse /var/lib/matrix-synapse
-          ${cfg.package}/bin/homeserver --config-path ${configFile} --keys-directory /var/lib/matrix-synapse/ --generate-keys
-        fi
+        ${cfg.package}/bin/homeserver \
+          --config-path ${configFile} \
+          --keys-directory /var/lib/matrix-synapse \
+          --generate-keys
       '';
       serviceConfig = {
         Type = "simple";
@@ -570,7 +574,7 @@ in {
         Group = "matrix-synapse";
         WorkingDirectory = "/var/lib/matrix-synapse";
         PermissionsStartOnly = true;
-        ExecStart = "${cfg.package}/bin/homeserver --config-path ${configFile}";
+        ExecStart = "${cfg.package}/bin/homeserver --config-path ${configFile} --keys-directory /var/lib/matrix-synapse";
       };
     };
   };
diff --git a/nixos/tests/mpich.nix b/nixos/tests/mpich.nix
deleted file mode 100644
index a28e41deb31e..000000000000
--- a/nixos/tests/mpich.nix
+++ /dev/null
@@ -1,41 +0,0 @@
-# Simple example to showcase distributed tests using NixOS VMs.
-
-import ./make-test.nix ({ pkgs, ...} : {
-  name = "mpich";
-  meta = with pkgs.stdenv.lib.maintainers; {
-    maintainers = [ eelco chaoflow ];
-  };
-
-  nodes = {
-    master =
-      { config, pkgs, ... }: {
-        environment.systemPackages = [ gcc mpich2 ];
-        #boot.kernelPackages = pkgs.kernelPackages_2_6_29;
-      };
-
-    slave =
-      { config, pkgs, ... }: {
-        environment.systemPackages = [ gcc mpich2 ];
-      };
-  };
-
-  # Start master/slave MPI daemons and compile/run a program that uses both
-  # nodes.
-  testScript =
-    ''
-       startAll;
-
-       $master->succeed("echo 'MPD_SECRETWORD=secret' > /etc/mpd.conf");
-       $master->succeed("chmod 600 /etc/mpd.conf");
-       $master->succeed("mpd --daemon --ifhn=master --listenport=4444");
-
-       $slave->succeed("echo 'MPD_SECRETWORD=secret' > /etc/mpd.conf");
-       $slave->succeed("chmod 600 /etc/mpd.conf");
-       $slave->succeed("mpd --daemon --host=master --port=4444");
-
-       $master->succeed("mpicc -o example -Wall ${./mpich-example.c}");
-       $slave->succeed("mpicc -o example -Wall ${./mpich-example.c}");
-
-       $master->succeed("mpiexec -n 2 ./example >&2");
-    '';
-})
diff --git a/nixos/tests/test-config-examples.sh b/nixos/tests/test-config-examples.sh
deleted file mode 100755
index 1ba2f841c41d..000000000000
--- a/nixos/tests/test-config-examples.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-# This script try to evaluate all configurations which are stored in
-# doc/config-examples.  This script is useful to ensure that examples are
-# working with the current system.
-
-pwd=$(pwd)
-set -xe
-for i in ../doc/config-examples/*.nix; do
-  NIXOS_CONFIG="$pwd/$i" nix-instantiate \
-      --eval-only --xml --strict > /dev/null 2>&1 \
-      ../default.nix -A system
-done
-set +xe