diff options
Diffstat (limited to 'nixos/modules/services')
-rw-r--r-- | nixos/modules/services/mail/postfix.nix | 19 | ||||
-rw-r--r-- | nixos/modules/services/misc/gitlab.nix | 6 | ||||
-rw-r--r-- | nixos/modules/services/misc/nixos-manual.nix | 5 | ||||
-rw-r--r-- | nixos/modules/services/misc/plexpy.nix | 81 | ||||
-rw-r--r-- | nixos/modules/services/monitoring/graphite.nix | 4 | ||||
-rw-r--r-- | nixos/modules/services/networking/dnschain.nix | 2 | ||||
-rw-r--r-- | nixos/modules/services/web-servers/apache-httpd/default.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/web-servers/apache-httpd/wordpress.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/x11/display-managers/gdm.nix | 1 |
9 files changed, 101 insertions, 19 deletions
diff --git a/nixos/modules/services/mail/postfix.nix b/nixos/modules/services/mail/postfix.nix index 1fef9ac6ec90..867c0ea6761c 100644 --- a/nixos/modules/services/mail/postfix.nix +++ b/nixos/modules/services/mail/postfix.nix @@ -60,11 +60,11 @@ let manpage_directory = "${pkgs.postfix}/share/man"; html_directory = "${pkgs.postfix}/share/postfix/doc/html"; shlib_directory = false; - relayhost = if cfg.lookupMX || cfg.relayHost == "" - then cfg.relayHost - else - "[${cfg.relayHost}]" - + optionalString (cfg.relayPort != null) ":${toString cfg.relayPort}"; + relayhost = if cfg.relayHost == "" then "" else + if cfg.lookupMX + then "${cfg.relayHost}:${toString cfg.relayPort}" + else "[${cfg.relayHost}]:${toString cfg.relayPort}"; + mail_spool_directory = "/var/spool/mail/"; setgid_group = setgidGroup; } @@ -461,13 +461,10 @@ in }; relayPort = mkOption { - type = types.nullOr types.int; - default = null; - example = 587; + type = types.int; + default = 25; description = " - Specify an optional port for outbound mail relay. (Note: - only used if an explicit <option>relayHost</option> is - defined.) + SMTP port for relay mail relay. "; }; diff --git a/nixos/modules/services/misc/gitlab.nix b/nixos/modules/services/misc/gitlab.nix index 740cbc141b53..7b2b40e59232 100644 --- a/nixos/modules/services/misc/gitlab.nix +++ b/nixos/modules/services/misc/gitlab.nix @@ -572,7 +572,7 @@ in { rm -rf ${cfg.statePath}/config ${cfg.statePath}/shell/hooks mkdir -p ${cfg.statePath}/config - tr -dc A-Za-z0-9 < /dev/urandom | head -c 32 > ${cfg.statePath}/config/gitlab_shell_secret + ${pkgs.openssl}/bin/openssl rand -hex 32 > ${cfg.statePath}/config/gitlab_shell_secret # The uploads directory is hardcoded somewhere deep in rails. It is # symlinked in the gitlab package to /run/gitlab/uploads to make it @@ -619,7 +619,7 @@ in { fi # enable required pg_trgm extension for gitlab - ${pkgs.sudo}/bin/sudo -u ${pgSuperUser} psql gitlab -c "CREATE EXTENSION IF NOT EXISTS pg_trgm" + ${pkgs.sudo}/bin/sudo -u ${pgSuperUser} psql ${cfg.databaseName} -c "CREATE EXTENSION IF NOT EXISTS pg_trgm" # Always do the db migrations just to be sure the database is up-to-date ${gitlab-rake}/bin/gitlab-rake db:migrate RAILS_ENV=production @@ -634,7 +634,7 @@ in { # The gitlab:shell:create_hooks task seems broken for fixing links # so we instead delete all the hooks and create them anew - rm ${cfg.statePath}/repositories/**/*.git/hooks + rm -f ${cfg.statePath}/repositories/**/*.git/hooks ${gitlab-rake}/bin/gitlab-rake gitlab:shell:create_hooks RAILS_ENV=production # Change permissions in the last step because some of the diff --git a/nixos/modules/services/misc/nixos-manual.nix b/nixos/modules/services/misc/nixos-manual.nix index 515864ec2e2d..41cadb4a6de0 100644 --- a/nixos/modules/services/misc/nixos-manual.nix +++ b/nixos/modules/services/misc/nixos-manual.nix @@ -135,8 +135,9 @@ in }; }; - services.mingetty.helpLine = mkIf cfg.showManual - "\nPress <Alt-F${toString cfg.ttyNumber}> for the NixOS manual."; + services.mingetty.helpLine = "\nRun `nixos-help` " + + lib.optionalString cfg.showManual "or press <Alt-F${toString cfg.ttyNumber}> " + + "for the NixOS manual."; }; diff --git a/nixos/modules/services/misc/plexpy.nix b/nixos/modules/services/misc/plexpy.nix new file mode 100644 index 000000000000..df9f12581247 --- /dev/null +++ b/nixos/modules/services/misc/plexpy.nix @@ -0,0 +1,81 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let + cfg = config.services.plexpy; +in +{ + options = { + services.plexpy = { + enable = mkEnableOption "PlexPy Plex Monitor"; + + dataDir = mkOption { + type = types.str; + default = "/var/lib/plexpy"; + description = "The directory where PlexPy stores its data files."; + }; + + configFile = mkOption { + type = types.str; + default = "/var/lib/plexpy/config.ini"; + description = "The location of PlexPy's config file."; + }; + + port = mkOption { + type = types.int; + default = 8181; + description = "TCP port where PlexPy listens."; + }; + + user = mkOption { + type = types.str; + default = "plexpy"; + description = "User account under which PlexPy runs."; + }; + + group = mkOption { + type = types.str; + default = "nogroup"; + description = "Group under which PlexPy runs."; + }; + + package = mkOption { + type = types.package; + default = pkgs.plexpy; + defaultText = "pkgs.plexpy"; + description = '' + The PlexPy package to use. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + systemd.services.plexpy = { + description = "PlexPy Plex Monitor"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + preStart = '' + test -d "${cfg.dataDir}" || { + echo "Creating initial PlexPy data directory in \"${cfg.dataDir}\"." + mkdir -p "${cfg.dataDir}" + chown ${cfg.user}:${cfg.group} "${cfg.dataDir}" + } + ''; + serviceConfig = { + Type = "simple"; + User = cfg.user; + Group = cfg.group; + PermissionsStartOnly = "true"; + GuessMainPID = "false"; + ExecStart = "${cfg.package}/bin/plexpy --datadir ${cfg.dataDir} --config ${cfg.configFile} --port ${toString cfg.port} --pidfile ${cfg.dataDir}/plexpy.pid --nolaunch"; + Restart = "on-failure"; + }; + }; + + users.extraUsers = mkIf (cfg.user == "plexpy") { + plexpy = { group = cfg.group; uid = config.ids.uids.plexpy; }; + }; + }; +} diff --git a/nixos/modules/services/monitoring/graphite.nix b/nixos/modules/services/monitoring/graphite.nix index 01b4aca91731..645dfeab0193 100644 --- a/nixos/modules/services/monitoring/graphite.nix +++ b/nixos/modules/services/monitoring/graphite.nix @@ -22,8 +22,8 @@ let ); graphiteApiConfig = pkgs.writeText "graphite-api.yaml" '' - time_zone: ${config.time.timeZone} search_index: ${dataDir}/index + ${optionalString (!isNull config.time.timeZone) ''time_zone: ${config.time.timeZone}''} ${optionalString (cfg.api.finders != []) ''finders:''} ${concatMapStringsSep "\n" (f: " - " + f.moduleName) cfg.api.finders} ${optionalString (cfg.api.functions != []) ''functions:''} @@ -536,7 +536,7 @@ in { environment = { PYTHONPATH = let aenv = pkgs.python.buildEnv.override { - extraLibs = [ cfg.api.package pkgs.cairo ] ++ cfg.api.finders; + extraLibs = [ cfg.api.package pkgs.cairo pkgs.pythonPackages.cffi ] ++ cfg.api.finders; }; in "${aenv}/${pkgs.python.sitePackages}"; GRAPHITE_API_CONFIG = graphiteApiConfig; diff --git a/nixos/modules/services/networking/dnschain.nix b/nixos/modules/services/networking/dnschain.nix index ab7bbb15ad4f..ee1cd3600039 100644 --- a/nixos/modules/services/networking/dnschain.nix +++ b/nixos/modules/services/networking/dnschain.nix @@ -158,7 +158,7 @@ in serviceConfig = { User = "dnschain"; Restart = "on-failure"; - ExecStart = "${pkgs.dnschain}/bin/dnschain"; + ExecStart = "${pkgs.nodePackages.dnschain}/bin/dnschain"; }; preStart = '' diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix index 1c3c7835d961..f9f2511f45dc 100644 --- a/nixos/modules/services/web-servers/apache-httpd/default.nix +++ b/nixos/modules/services/web-servers/apache-httpd/default.nix @@ -676,6 +676,7 @@ in '' ; Needed for PHP's mail() function. sendmail_path = sendmail -t -i + '' + optionalString (!isNull config.time.timeZone) '' ; Apparently PHP doesn't use $TZ. date.timezone = "${config.time.timeZone}" diff --git a/nixos/modules/services/web-servers/apache-httpd/wordpress.nix b/nixos/modules/services/web-servers/apache-httpd/wordpress.nix index c6f4bcd0f666..1c654667dfc7 100644 --- a/nixos/modules/services/web-servers/apache-httpd/wordpress.nix +++ b/nixos/modules/services/web-servers/apache-httpd/wordpress.nix @@ -13,6 +13,7 @@ let define('DB_HOST', '${config.dbHost}'); define('DB_CHARSET', 'utf8'); $table_prefix = '${config.tablePrefix}'; + define('AUTOMATIC_UPDATER_DISABLED', true); ${config.extraConfig} if ( !defined('ABSPATH') ) define('ABSPATH', dirname(__FILE__) . '/'); diff --git a/nixos/modules/services/x11/display-managers/gdm.nix b/nixos/modules/services/x11/display-managers/gdm.nix index 83c5c95dae7e..e83f26516f5f 100644 --- a/nixos/modules/services/x11/display-managers/gdm.nix +++ b/nixos/modules/services/x11/display-managers/gdm.nix @@ -125,6 +125,7 @@ in "getty@tty1.service" ]; + systemd.services."getty@tty1".enable = false; systemd.services.display-manager.conflicts = [ "getty@tty1.service" ]; systemd.services.display-manager.serviceConfig = { # Restart = "always"; - already defined in xserver.nix |