diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2016-10-26 13:06:43 +0200 |
---|---|---|
committer | Frederik Rietdijk <fridh@fridh.nl> | 2016-10-26 13:06:43 +0200 |
commit | 7077a270bf625b320ab61e3951aa19c9d514b5dc (patch) | |
tree | 42660271ea34c60368a6e3393ac5eedb65fe4a78 /nixos/modules/services | |
parent | fea23020fef87f20fe81477d33eb9b8ca72e7f2e (diff) | |
parent | 2273849a85e49d3a1fe55d11110cebb3377dddf6 (diff) | |
download | nixlib-7077a270bf625b320ab61e3951aa19c9d514b5dc.tar nixlib-7077a270bf625b320ab61e3951aa19c9d514b5dc.tar.gz nixlib-7077a270bf625b320ab61e3951aa19c9d514b5dc.tar.bz2 nixlib-7077a270bf625b320ab61e3951aa19c9d514b5dc.tar.lz nixlib-7077a270bf625b320ab61e3951aa19c9d514b5dc.tar.xz nixlib-7077a270bf625b320ab61e3951aa19c9d514b5dc.tar.zst nixlib-7077a270bf625b320ab61e3951aa19c9d514b5dc.zip |
Merge remote-tracking branch 'upstream/master' into HEAD
Diffstat (limited to 'nixos/modules/services')
36 files changed, 214 insertions, 138 deletions
diff --git a/nixos/modules/services/audio/mpd.nix b/nixos/modules/services/audio/mpd.nix index 85e0a7d2ac4e..5ec2e2c26232 100644 --- a/nixos/modules/services/audio/mpd.nix +++ b/nixos/modules/services/audio/mpd.nix @@ -49,7 +49,7 @@ in { }; extraConfig = mkOption { - type = types.str; + type = types.lines; default = ""; description = '' Extra directives added to to the end of MPD's configuration file, diff --git a/nixos/modules/services/backup/bacula.nix b/nixos/modules/services/backup/bacula.nix index ef8e5e55edef..340b0cf07234 100644 --- a/nixos/modules/services/backup/bacula.nix +++ b/nixos/modules/services/backup/bacula.nix @@ -340,6 +340,7 @@ in { extraConfig = mkOption { default = ""; + type = types.lines; description = '' Extra configuration for Bacula Director Daemon. ''; diff --git a/nixos/modules/services/databases/neo4j.nix b/nixos/modules/services/databases/neo4j.nix index 146a604adb2f..7b51f1af6899 100644 --- a/nixos/modules/services/databases/neo4j.nix +++ b/nixos/modules/services/databases/neo4j.nix @@ -5,34 +5,34 @@ with lib; let cfg = config.services.neo4j; - serverConfig = pkgs.writeText "neo4j-server.properties" '' - org.neo4j.server.database.location=${cfg.dataDir}/data/graph.db - org.neo4j.server.webserver.address=${cfg.listenAddress} - org.neo4j.server.webserver.port=${toString cfg.port} + serverConfig = pkgs.writeText "neo4j.conf" '' + dbms.directories.data=${cfg.dataDir}/data + dbms.directories.certificates=${cfg.certDir} + dbms.directories.logs=${cfg.dataDir}/logs + dbms.directories.plugins=${cfg.dataDir}/plugins + dbms.connector.http.type=HTTP + dbms.connector.http.enabled=true + dbms.connector.http.address=${cfg.listenAddress}:${toString cfg.port} + ${optionalString cfg.enableBolt '' + dbms.connector.bolt.type=BOLT + dbms.connector.bolt.enabled=true + dbms.connector.bolt.tls_level=OPTIONAL + dbms.connector.bolt.address=${cfg.listenAddress}:${toString cfg.boltPort} + ''} ${optionalString cfg.enableHttps '' - org.neo4j.server.webserver.https.enabled=true - org.neo4j.server.webserver.https.port=${toString cfg.httpsPort} - org.neo4j.server.webserver.https.cert.location=${cfg.cert} - org.neo4j.server.webserver.https.key.location=${cfg.key} - org.neo4j.server.webserver.https.keystore.location=${cfg.dataDir}/data/keystore + dbms.connector.https.type=HTTP + dbms.connector.https.enabled=true + dbms.connector.https.encryption=TLS + dbms.connector.https.address=${cfg.listenAddress}:${toString cfg.httpsPort} ''} - org.neo4j.server.webadmin.rrdb.location=${cfg.dataDir}/data/rrd - org.neo4j.server.webadmin.data.uri=/db/data/ - org.neo4j.server.webadmin.management.uri=/db/manage/ - org.neo4j.server.db.tuning.properties=${cfg.package}/share/neo4j/conf/neo4j.properties - org.neo4j.server.manage.console_engines=shell + dbms.shell.enabled=true ${cfg.extraServerConfig} ''; - loggingConfig = pkgs.writeText "logging.properties" cfg.loggingConfig; - wrapperConfig = pkgs.writeText "neo4j-wrapper.conf" '' - wrapper.java.additional=-Dorg.neo4j.server.properties=${serverConfig} - wrapper.java.additional=-Djava.util.logging.config.file=${loggingConfig} - wrapper.java.additional=-XX:+UseConcMarkSweepGC - wrapper.java.additional=-XX:+CMSClassUnloadingEnabled - wrapper.pidfile=${cfg.dataDir}/neo4j-server.pid - wrapper.name=neo4j + dbms.jvm.additional=-Dunsupported.dbms.udc.source=tarball + dbms.jvm.additional=-XX:+UseConcMarkSweepGC + dbms.jvm.additional=-XX:+CMSClassUnloadingEnabled ''; in { @@ -65,6 +65,18 @@ in { type = types.int; }; + enableBolt = mkOption { + description = "Enable bolt for Neo4j."; + default = true; + type = types.bool; + }; + + boltPort = mkOption { + description = "Neo4j port to listen for BOLT traffic."; + default = 7687; + type = types.int; + }; + enableHttps = mkOption { description = "Enable https for Neo4j."; default = false; @@ -77,15 +89,9 @@ in { type = types.int; }; - cert = mkOption { - description = "Neo4j https certificate."; - default = "${cfg.dataDir}/conf/ssl/neo4j.cert"; - type = types.path; - }; - - key = mkOption { - description = "Neo4j https certificate key."; - default = "${cfg.dataDir}/conf/ssl/neo4j.key"; + certDir = mkOption { + description = "Neo4j TLS certificates directory."; + default = "${cfg.dataDir}/certificates"; type = types.path; }; @@ -95,26 +101,11 @@ in { type = types.path; }; - loggingConfig = mkOption { - description = "Neo4j logging configuration."; - default = '' - handlers=java.util.logging.ConsoleHandler - .level=INFO - org.neo4j.server.level=INFO - - java.util.logging.ConsoleHandler.level=INFO - java.util.logging.ConsoleHandler.formatter=org.neo4j.server.logging.SimpleConsoleFormatter - java.util.logging.ConsoleHandler.filter=org.neo4j.server.logging.NeoLogFilter - ''; - type = types.lines; - }; - extraServerConfig = mkOption { description = "Extra configuration for neo4j server."; default = ""; type = types.lines; }; - }; ###### implementation @@ -124,14 +115,18 @@ in { description = "Neo4j Daemon"; wantedBy = [ "multi-user.target" ]; after = [ "network.target" ]; - environment = { NEO4J_INSTANCE = cfg.dataDir; }; + environment = { + NEO4J_HOME = "${cfg.package}/share/neo4j"; + NEO4J_CONF = "${cfg.dataDir}/conf"; + }; serviceConfig = { ExecStart = "${cfg.package}/bin/neo4j console"; User = "neo4j"; PermissionsStartOnly = true; }; preStart = '' - mkdir -m 0700 -p ${cfg.dataDir}/{data/graph.db,conf} + mkdir -m 0700 -p ${cfg.dataDir}/{data/graph.db,conf,logs} + ln -fs ${serverConfig} ${cfg.dataDir}/conf/neo4j.conf ln -fs ${wrapperConfig} ${cfg.dataDir}/conf/neo4j-wrapper.conf if [ "$(id -u)" = 0 ]; then chown -R neo4j ${cfg.dataDir}; fi ''; @@ -146,5 +141,4 @@ in { home = cfg.dataDir; }; }; - } diff --git a/nixos/modules/services/databases/openldap.nix b/nixos/modules/services/databases/openldap.nix index 875ed0f39db8..b8e6c0cec3dc 100644 --- a/nixos/modules/services/databases/openldap.nix +++ b/nixos/modules/services/databases/openldap.nix @@ -54,8 +54,8 @@ in }; configDir = mkOption { - type = types.path; - default = ""; + type = types.nullOr types.path; + default = null; description = "Use this optional config directory instead of using slapd.conf"; example = "/var/db/slapd.d"; }; @@ -103,7 +103,7 @@ in mkdir -p ${cfg.dataDir} chown -R ${cfg.user}:${cfg.group} ${cfg.dataDir} ''; - serviceConfig.ExecStart = "${openldap.out}/libexec/slapd -u ${cfg.user} -g ${cfg.group} -d 0 -h \"${concatStringsSep " " cfg.urlList}\" ${if cfg.configDir == "" then "-f "+configFile else "-F "+cfg.configDir}"; + serviceConfig.ExecStart = "${openldap.out}/libexec/slapd -u ${cfg.user} -g ${cfg.group} -d 0 -h \"${concatStringsSep " " cfg.urlList}\" ${if cfg.configDir == null then "-f "+configFile else "-F "+cfg.configDir}"; }; users.extraUsers.openldap = diff --git a/nixos/modules/services/hardware/brltty.nix b/nixos/modules/services/hardware/brltty.nix index 03e530b2c96d..b416ba332222 100644 --- a/nixos/modules/services/hardware/brltty.nix +++ b/nixos/modules/services/hardware/brltty.nix @@ -28,7 +28,7 @@ in { }; serviceConfig = { ExecStart = "${pkgs.brltty}/bin/brltty --no-daemon"; - Type = "simple"; # Change to notidy after next releae + Type = "notify"; TimeoutStartSec = 5; TimeoutStopSec = 10; Restart = "always"; diff --git a/nixos/modules/services/hardware/tlp.nix b/nixos/modules/services/hardware/tlp.nix index 281d02a8c65e..f36a9e7b4596 100644 --- a/nixos/modules/services/hardware/tlp.nix +++ b/nixos/modules/services/hardware/tlp.nix @@ -40,7 +40,7 @@ in }; extraConfig = mkOption { - type = types.str; + type = types.lines; default = ""; description = "Additional configuration variables for TLP"; }; diff --git a/nixos/modules/services/mail/dovecot.nix b/nixos/modules/services/mail/dovecot.nix index e79d5dadd828..4c9df935debe 100644 --- a/nixos/modules/services/mail/dovecot.nix +++ b/nixos/modules/services/mail/dovecot.nix @@ -111,7 +111,7 @@ in }; extraConfig = mkOption { - type = types.str; + type = types.lines; default = ""; example = "mail_debug = yes"; description = "Additional entries to put verbatim into Dovecot's config file."; diff --git a/nixos/modules/services/misc/bepasty.nix b/nixos/modules/services/misc/bepasty.nix index 5bda73ab64f0..52719222db66 100644 --- a/nixos/modules/services/misc/bepasty.nix +++ b/nixos/modules/services/misc/bepasty.nix @@ -53,7 +53,7 @@ in }; extraConfig = mkOption { - type = types.str; + type = types.lines; description = '' Extra configuration for bepasty server to be appended on the configuration. diff --git a/nixos/modules/services/misc/nix-gc.nix b/nixos/modules/services/misc/nix-gc.nix index 5c13da6e83dd..304168c65b0b 100644 --- a/nixos/modules/services/misc/nix-gc.nix +++ b/nixos/modules/services/misc/nix-gc.nix @@ -53,7 +53,7 @@ in systemd.services.nix-gc = { description = "Nix Garbage Collector"; script = "exec ${config.nix.package.out}/bin/nix-collect-garbage ${cfg.options}"; - startAt = optionalString cfg.automatic cfg.dates; + startAt = optional cfg.automatic cfg.dates; }; }; diff --git a/nixos/modules/services/misc/redmine.nix b/nixos/modules/services/misc/redmine.nix index 7c9483911f21..e3f1ec67cbb3 100644 --- a/nixos/modules/services/misc/redmine.nix +++ b/nixos/modules/services/misc/redmine.nix @@ -71,7 +71,7 @@ in { }; extraConfig = mkOption { - type = types.str; + type = types.lines; default = ""; description = "Extra configuration in configuration.yml"; }; diff --git a/nixos/modules/services/monitoring/bosun.nix b/nixos/modules/services/monitoring/bosun.nix index 9a1e790d3ab6..496838a131ba 100644 --- a/nixos/modules/services/monitoring/bosun.nix +++ b/nixos/modules/services/monitoring/bosun.nix @@ -107,7 +107,7 @@ in { }; extraConfig = mkOption { - type = types.string; + type = types.lines; default = ""; description = '' Extra configuration options for Bosun. You should describe your diff --git a/nixos/modules/services/monitoring/graphite.nix b/nixos/modules/services/monitoring/graphite.nix index 1de3320dc42c..b8be9296bc97 100644 --- a/nixos/modules/services/monitoring/graphite.nix +++ b/nixos/modules/services/monitoring/graphite.nix @@ -167,7 +167,7 @@ in { CACHE_TYPE: 'filesystem' CACHE_DIR: '/tmp/graphite-api-cache' ''; - type = types.str; + type = types.lines; }; }; diff --git a/nixos/modules/services/monitoring/munin.nix b/nixos/modules/services/monitoring/munin.nix index aaa041ad4cd6..57df16b58d9c 100644 --- a/nixos/modules/services/monitoring/munin.nix +++ b/nixos/modules/services/monitoring/munin.nix @@ -100,6 +100,7 @@ in extraConfig = mkOption { default = ""; + type = types.lines; description = '' <filename>munin-node.conf</filename> extra configuration. See <link xlink:href='http://munin-monitoring.org/wiki/munin-node.conf' /> diff --git a/nixos/modules/services/monitoring/zabbix-agent.nix b/nixos/modules/services/monitoring/zabbix-agent.nix index a943075be0c4..88a63b4bf161 100644 --- a/nixos/modules/services/monitoring/zabbix-agent.nix +++ b/nixos/modules/services/monitoring/zabbix-agent.nix @@ -53,6 +53,7 @@ in extraConfig = mkOption { default = ""; + type = types.lines; description = '' Configuration that is injected verbatim into the configuration file. ''; diff --git a/nixos/modules/services/network-filesystems/xtreemfs.nix b/nixos/modules/services/network-filesystems/xtreemfs.nix index b051214e1d08..0c6714563d8a 100644 --- a/nixos/modules/services/network-filesystems/xtreemfs.nix +++ b/nixos/modules/services/network-filesystems/xtreemfs.nix @@ -153,6 +153,7 @@ in ''; }; extraConfig = mkOption { + type = types.lines; default = ""; example = '' # specify whether SSL is required @@ -173,6 +174,7 @@ in replication = { enable = mkEnableOption "XtreemFS DIR replication plugin"; extraConfig = mkOption { + type = types.lines; example = '' # participants of the replication including this replica babudb.repl.participant.0 = 192.168.0.10 @@ -269,6 +271,7 @@ in ''; }; extraConfig = mkOption { + type = types.lines; example = '' osd_check_interval = 300 no_atime = true @@ -307,6 +310,7 @@ in replication = { enable = mkEnableOption "XtreemFS MRC replication plugin"; extraConfig = mkOption { + type = types.lines; example = '' # participants of the replication including this replica babudb.repl.participant.0 = 192.168.0.10 @@ -385,6 +389,7 @@ in ''; }; extraConfig = mkOption { + type = types.lines; example = '' local_clock_renewal = 0 remote_time_sync = 30000 diff --git a/nixos/modules/services/networking/atftpd.nix b/nixos/modules/services/networking/atftpd.nix index d875ddc63528..e7fd48c99a85 100644 --- a/nixos/modules/services/networking/atftpd.nix +++ b/nixos/modules/services/networking/atftpd.nix @@ -20,13 +20,27 @@ in default = false; type = types.bool; description = '' - Whenever to enable the atftpd TFTP server. + Whether to enable the atftpd TFTP server. By default, the server + binds to address 0.0.0.0. + ''; + }; + + extraOptions = mkOption { + default = []; + type = types.listOf types.str; + example = literalExample '' + [ "--bind-address 192.168.9.1" + "--verbose=7" + ] + ''; + description = '' + Extra command line arguments to pass to atftp. ''; }; root = mkOption { - default = "/var/empty"; - type = types.str; + default = "/srv/tftp"; + type = types.path; description = '' Document root directory for the atftpd. ''; @@ -39,11 +53,11 @@ in config = mkIf cfg.enable { systemd.services.atftpd = { - description = "atftpd TFTP server"; + description = "TFTP Server"; after = [ "network.target" ]; wantedBy = [ "multi-user.target" ]; # runs as nobody - serviceConfig.ExecStart = "${pkgs.atftp}/sbin/atftpd --daemon --no-fork --bind-address 0.0.0.0 ${cfg.root}"; + serviceConfig.ExecStart = "${pkgs.atftp}/sbin/atftpd --daemon --no-fork ${lib.concatStringsSep " " cfg.extraOptions} ${cfg.root}"; }; }; diff --git a/nixos/modules/services/networking/bind.nix b/nixos/modules/services/networking/bind.nix index 41d7128ec31e..72110e625766 100644 --- a/nixos/modules/services/networking/bind.nix +++ b/nixos/modules/services/networking/bind.nix @@ -113,6 +113,7 @@ in }; extraConfig = mkOption { + type = types.lines; default = ""; description = " Extra lines to be added verbatim to the generated named configuration file. diff --git a/nixos/modules/services/networking/chrony.nix b/nixos/modules/services/networking/chrony.nix index a38142b4a08f..d40865ebbd5b 100644 --- a/nixos/modules/services/networking/chrony.nix +++ b/nixos/modules/services/networking/chrony.nix @@ -51,6 +51,7 @@ in }; extraConfig = mkOption { + type = types.lines; default = ""; description = '' Extra configuration directives that should be added to diff --git a/nixos/modules/services/networking/cntlm.nix b/nixos/modules/services/networking/cntlm.nix index 76c0fd7d0ea3..890ff5084078 100644 --- a/nixos/modules/services/networking/cntlm.nix +++ b/nixos/modules/services/networking/cntlm.nix @@ -61,6 +61,7 @@ in }; extraConfig = mkOption { + type = types.lines; default = ""; description = "Verbatim contents of <filename>cntlm.conf</filename>."; }; diff --git a/nixos/modules/services/networking/ddclient.nix b/nixos/modules/services/networking/ddclient.nix index e74d68cad902..5050ecbd7492 100644 --- a/nixos/modules/services/networking/ddclient.nix +++ b/nixos/modules/services/networking/ddclient.nix @@ -89,7 +89,7 @@ in extraConfig = mkOption { default = ""; - type = str; + type = lines; description = '' Extra configuration. Contents will be added verbatim to the configuration file. ''; diff --git a/nixos/modules/services/networking/dhcpd.nix b/nixos/modules/services/networking/dhcpd.nix index 36b4c5d5c1ef..d2cd00e74a1f 100644 --- a/nixos/modules/services/networking/dhcpd.nix +++ b/nixos/modules/services/networking/dhcpd.nix @@ -47,6 +47,7 @@ in }; extraConfig = mkOption { + type = types.lines; default = ""; example = '' option subnet-mask 255.255.255.0; diff --git a/nixos/modules/services/networking/hostapd.nix b/nixos/modules/services/networking/hostapd.nix index 287964aab072..51f95af48029 100644 --- a/nixos/modules/services/networking/hostapd.nix +++ b/nixos/modules/services/networking/hostapd.nix @@ -140,7 +140,7 @@ in ieee80211n=1 ht_capab=[HT40-][SHORT-GI-40][DSSS_CCK-40] ''; - type = types.string; + type = types.lines; description = "Extra configuration options to put in hostapd.conf."; }; }; diff --git a/nixos/modules/services/networking/kippo.nix b/nixos/modules/services/networking/kippo.nix index 1e7f7437b8a1..834de4fdc09f 100644 --- a/nixos/modules/services/networking/kippo.nix +++ b/nixos/modules/services/networking/kippo.nix @@ -46,7 +46,7 @@ rec { }; extraConfig = mkOption { default = ""; - type = types.string; + type = types.lines; description = ''Extra verbatim configuration added to the end of kippo.cfg.''; }; }; diff --git a/nixos/modules/services/networking/murmur.nix b/nixos/modules/services/networking/murmur.nix index 134544cda681..81f968ae9fe1 100644 --- a/nixos/modules/services/networking/murmur.nix +++ b/nixos/modules/services/networking/murmur.nix @@ -230,7 +230,7 @@ in }; extraConfig = mkOption { - type = types.str; + type = types.lines; default = ""; description = "Extra configuration to put into mumur.ini."; }; diff --git a/nixos/modules/services/networking/openfire.nix b/nixos/modules/services/networking/openfire.nix index ed91b45ec945..454b504eda21 100644 --- a/nixos/modules/services/networking/openfire.nix +++ b/nixos/modules/services/networking/openfire.nix @@ -47,7 +47,7 @@ with lib; export HOME=/tmp mkdir /var/log/openfire || true mkdir /etc/openfire || true - for i in ${openfire}/conf.inst/*; do + for i in ${pkgs.openfire}/conf.inst/*; do if ! test -f /etc/openfire/$(basename $i); then cp $i /etc/openfire/ fi diff --git a/nixos/modules/services/networking/prayer.nix b/nixos/modules/services/networking/prayer.nix index cb8fe6bf4fe9..9d63f549b23a 100644 --- a/nixos/modules/services/networking/prayer.nix +++ b/nixos/modules/services/networking/prayer.nix @@ -56,6 +56,7 @@ in }; extraConfig = mkOption { + type = types.lines; default = "" ; description = '' Extra configuration. Contents will be added verbatim to the configuration file. diff --git a/nixos/modules/services/networking/prosody.nix b/nixos/modules/services/networking/prosody.nix index 247c4f1efb07..5682b506344c 100644 --- a/nixos/modules/services/networking/prosody.nix +++ b/nixos/modules/services/networking/prosody.nix @@ -195,6 +195,7 @@ in }; extraConfig = mkOption { + type = types.lines; default = ''''; description = "Additional prosody configuration"; }; diff --git a/nixos/modules/services/networking/smokeping.nix b/nixos/modules/services/networking/smokeping.nix index cc373ae892ac..0c1f8d8cdb91 100644 --- a/nixos/modules/services/networking/smokeping.nix +++ b/nixos/modules/services/networking/smokeping.nix @@ -244,7 +244,7 @@ in description = "Target configuration"; }; extraConfig = mkOption { - type = types.string; + type = types.lines; default = ""; description = "Any additional customization not already included."; }; diff --git a/nixos/modules/services/networking/tftpd.nix b/nixos/modules/services/networking/tftpd.nix index 9b3cc6b8ec4f..c9c0a2b321d5 100644 --- a/nixos/modules/services/networking/tftpd.nix +++ b/nixos/modules/services/networking/tftpd.nix @@ -13,12 +13,13 @@ with lib; default = false; description = '' Whether to enable tftpd, a Trivial File Transfer Protocol server. + The server will be run as an xinetd service. ''; }; services.tftpd.path = mkOption { type = types.path; - default = "/home/tftp"; + default = "/srv/tftp"; description = '' Where the tftp server files are stored. ''; diff --git a/nixos/modules/services/networking/unbound.nix b/nixos/modules/services/networking/unbound.nix index 6375ebee3209..f3a04d97c98e 100644 --- a/nixos/modules/services/networking/unbound.nix +++ b/nixos/modules/services/networking/unbound.nix @@ -79,7 +79,7 @@ in extraConfig = mkOption { default = ""; - type = types.str; + type = types.lines; description = '' Extra unbound config. See <citerefentry><refentrytitle>unbound.conf</refentrytitle><manvolnum>8 diff --git a/nixos/modules/services/networking/xinetd.nix b/nixos/modules/services/networking/xinetd.nix index 270122ee659c..002245027804 100644 --- a/nixos/modules/services/networking/xinetd.nix +++ b/nixos/modules/services/networking/xinetd.nix @@ -124,7 +124,7 @@ in }; extraConfig = mkOption { - type = types.string; + type = types.lines; default = ""; description = "Extra configuration-lines added to the section of the service."; }; diff --git a/nixos/modules/services/networking/znc.nix b/nixos/modules/services/networking/znc.nix index 196a14dd40ed..676e82aa8937 100644 --- a/nixos/modules/services/networking/znc.nix +++ b/nixos/modules/services/networking/znc.nix @@ -26,53 +26,35 @@ let }; # Keep znc.conf in nix store, then symlink or copy into `dataDir`, depending on `mutable`. + notNull = a: ! isNull a; mkZncConf = confOpts: '' - // Also check http://en.znc.in/wiki/Configuration - - AnonIPLimit = 10 - ConnectDelay = 5 - # Add `LoadModule = x` for each module... + Version = 1.6.3 ${concatMapStrings (n: "LoadModule = ${n}\n") confOpts.modules} - MaxBufferSize = 500 - ProtectWebSessions = true - SSLCertFile = ${cfg.dataDir}/znc.pem - ServerThrottle = 30 - Skin = dark-clouds - StatusPrefix = * - Version = 1.2 - - <Listener listener0> - AllowIRC = true - AllowWeb = true + + <Listener l> + Port = ${toString confOpts.port} IPv4 = true - IPv6 = false - Port = ${if confOpts.useSSL then "+" else ""}${toString confOpts.port} + IPv6 = true SSL = ${if confOpts.useSSL then "true" else "false"} </Listener> <User ${confOpts.userName}> + ${confOpts.passBlock} Admin = true - Allow = * - AltNick = ${confOpts.nick}_ - AppendTimestamp = false - AutoClearChanBuffer = false - Buffer = 150 - ChanModes = +stn - DenyLoadMod = false - DenySetBindHost = false - Ident = ident - JoinTries = 10 - MaxJoins = 0 - MaxNetworks = 1 - MultiClients = true Nick = ${confOpts.nick} - PrependTimestamp = true - QuitMsg = Quit + AltNick = ${confOpts.nick}_ + Ident = ${confOpts.nick} RealName = ${confOpts.nick} - TimestampFormat = [%H:%M:%S] ${concatMapStrings (n: "LoadModule = ${n}\n") confOpts.userModules} - - ${confOpts.passBlock} + + ${ lib.concatStringsSep "\n" (lib.mapAttrsToList (name: net: '' + <Network ${name}> + ${concatMapStrings (m: "LoadModule = ${m}\n") net.modules} + Server = ${net.server} ${if net.useSSL then "+" else ""}${toString net.port} + + ${concatMapStrings (c: "<Chan #${c}>\n</Chan>\n") net.channels} + </Network> + '') confOpts.networks) } </User> ${confOpts.extraZncConf} ''; @@ -84,6 +66,62 @@ let else mkZncConf cfg.confOptions; }; + networkOpts = { ... }: { + options = { + server = mkOption { + type = types.str; + example = "chat.freenode.net"; + description = '' + IRC server address. + ''; + }; + + port = mkOption { + type = types.int; + default = 6697; + example = 6697; + description = '' + IRC server port. + ''; + }; + + useSSL = mkOption { + type = types.bool; + default = true; + description = '' + Whether to use SSL to connect to the IRC server. + ''; + }; + + modulePackages = mkOption { + type = types.listOf types.package; + default = []; + example = [ "pkgs.zncModules.push" "pkgs.zncModules.fish" ]; + description = '' + External ZNC modules to build. + ''; + }; + + modules = mkOption { + type = types.listOf types.str; + default = [ "simple_away" ]; + example = literalExample "[ simple_away sasl ]"; + description = '' + ZNC modules to load. + ''; + }; + + channels = mkOption { + type = types.listOf types.str; + default = []; + example = [ "nixos" ]; + description = '' + IRC channels to join. + ''; + }; + }; + }; + in { @@ -111,6 +149,15 @@ in ''; }; + group = mkOption { + default = ""; + example = "users"; + type = types.string; + description = '' + Group to own the ZNCserver process. + ''; + }; + dataDir = mkOption { default = "/var/lib/znc/"; example = "/home/john/.znc/"; @@ -125,27 +172,16 @@ in example = "See: http://wiki.znc.in/Configuration"; type = types.lines; description = '' - The contents of the `znc.conf` file to use when creating it. + Config file as generated with `znc --makeconf` to use for the whole ZNC configuration. If specified, `confOptions` will be ignored, and this value, as-is, will be used. If left empty, a conf file with default values will be used. - Recommended to generate with `znc --makeconf` command. ''; }; - /* TODO: add to the documentation of the current module: - - Values to use when creating a `znc.conf` file. - - confOptions = { - modules = [ "log" ]; - userName = "john"; - nick = "johntron"; - }; - */ confOptions = { modules = mkOption { type = types.listOf types.str; - default = [ "partyline" "webadmin" "adminlog" "log" ]; + default = [ "webadmin" "adminlog" ]; example = [ "partyline" "webadmin" "adminlog" "log" ]; description = '' A list of modules to include in the `znc.conf` file. @@ -154,8 +190,8 @@ in userModules = mkOption { type = types.listOf types.str; - default = [ ]; - example = [ "fish" "push" ]; + default = [ "chansaver" "controlpanel" ]; + example = [ "chansaver" "controlpanel" "fish" "push" ]; description = '' A list of user modules to include in the `znc.conf` file. ''; @@ -166,9 +202,25 @@ in example = "johntron"; type = types.string; description = '' - The user name to use when generating the `znc.conf` file. - This is the user name used by the user logging into the ZNC web admin. + The user name used to log in to the ZNC web admin interface. + ''; + }; + + networks = mkOption { + default = { }; + type = types.loaOf types.optionSet; + description = '' + IRC networks to connect the user to. ''; + options = [ networkOpts ]; + example = { + "freenode" = { + server = "chat.freenode.net"; + port = 6697; + ssl = true; + modules = [ "simple_away" ]; + }; + }; }; nick = mkOption { @@ -176,19 +228,16 @@ in example = "john"; type = types.string; description = '' - The IRC nick to use when generating the `znc.conf` file. + The IRC nick. ''; }; passBlock = mkOption { - default = defaultPassBlock; - example = "Must be the block generated by the `znc --makepass` command."; + example = defaultPassBlock; type = types.string; description = '' - The pass block to use when generating the `znc.conf` file. - This is the password used by the user logging into the ZNC web admin. - This is the block generated by the `znc --makepass` command. - !!! If not specified, please change this after starting the service. !!! + Generate with znc --makepass. + This is the password used to log in to the ZNC web admin interface. ''; }; @@ -206,7 +255,7 @@ in example = true; type = types.bool; description = '' - Indicates whether the ZNC server should use SSL when listening on the specified port. + Indicates whether the ZNC server should use SSL when listening on the specified port. A self-signed certificate will be generated. ''; }; @@ -214,7 +263,7 @@ in default = ""; type = types.lines; description = '' - Extra config to `znc.conf` file + Extra config to `znc.conf` file. ''; }; }; @@ -265,6 +314,7 @@ in after = [ "network.service" ]; serviceConfig = { User = cfg.user; + Group = cfg.group; Restart = "always"; ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID"; ExecStop = "${pkgs.coreutils}/bin/kill -INT $MAINPID"; diff --git a/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix b/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix index 4f9e9f52f9e0..1ed489bcb095 100644 --- a/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix +++ b/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix @@ -288,6 +288,7 @@ in }; extraConfig = mkOption { + type = types.lines; default = ""; example = '' diff --git a/nixos/modules/services/web-servers/apache-httpd/moodle.nix b/nixos/modules/services/web-servers/apache-httpd/moodle.nix index aa00e89967db..d525348d5c7e 100644 --- a/nixos/modules/services/web-servers/apache-httpd/moodle.nix +++ b/nixos/modules/services/web-servers/apache-httpd/moodle.nix @@ -164,6 +164,7 @@ in extraConfig = mkOption { + type = types.lines; default = ""; example = '' diff --git a/nixos/modules/services/web-servers/apache-httpd/wordpress.nix b/nixos/modules/services/web-servers/apache-httpd/wordpress.nix index 2315c4729aec..32dd4439675a 100644 --- a/nixos/modules/services/web-servers/apache-httpd/wordpress.nix +++ b/nixos/modules/services/web-servers/apache-httpd/wordpress.nix @@ -212,6 +212,7 @@ in example = "[ \"en_GB\" \"de_DE\" ];"; }; extraConfig = mkOption { + type = types.lines; default = ""; example = '' diff --git a/nixos/modules/services/x11/display-managers/sddm.nix b/nixos/modules/services/x11/display-managers/sddm.nix index c79893e77aa6..36daf55a36a5 100644 --- a/nixos/modules/services/x11/display-managers/sddm.nix +++ b/nixos/modules/services/x11/display-managers/sddm.nix @@ -86,7 +86,7 @@ in }; extraConfig = mkOption { - type = types.str; + type = types.lines; default = ""; example = '' [Autologin] |