diff --git a/system/options.nix b/system/options.nix index 9ce0daf9de72..20152ddc2061 100644 --- a/system/options.nix +++ b/system/options.nix @@ -2286,6 +2286,12 @@ in How to authorize users. Note: ident needs absolute trust to all allowed client hosts."; }; + enableTCPIP = mkOption { + default = false; + description = " + Whether to run PostgreSQL with -i flag to enable TCP/IP connections. + "; + }; }; diff --git a/upstart-jobs/postgresql.nix b/upstart-jobs/postgresql.nix index a37780678fc9..83ab1d5962de 100644 --- a/upstart-jobs/postgresql.nix +++ b/upstart-jobs/postgresql.nix @@ -13,7 +13,7 @@ let in -{ +rec { name = "postgresql"; users = [ @@ -28,6 +28,9 @@ in extraPath = [postgresql]; + flags = + if cfg.enableTCPIP then ["-i"] else [] ; + job = '' description "PostgreSQL server" @@ -43,6 +46,6 @@ in cp -f ${pkgs.writeText "pg_hba.conf" cfg.authentication} ${cfg.dataDir}/pg_hba.conf end script - respawn ${run} -c '${postgresql}/bin/postgres -D ${cfg.dataDir}' + respawn ${run} -c '${postgresql}/bin/postgres -D ${cfg.dataDir} ${toString flags}' ''; }