NixOS configuration 馃獎
at refactor/style 37 lines 790 B view raw
1{ 2 lib, 3 config, 4 self, 5 pkgs, 6 ... 7}: 8let 9 inherit (lib) mkIf mkForce; 10 inherit (lib.types) bool; 11 12 inherit (self.lib.modules) mkOpt; 13 cfg = config.sylveon.services.postgres; 14in 15{ 16 options.sylveon.services.postgres = { 17 enable = mkOpt bool false "Enable postgres databases"; 18 }; 19 20 config = mkIf cfg.enable { 21 services.postgresql = { 22 enable = true; 23 package = pkgs.postgresql; 24 25 # Allow access to databases for users with the same username 26 authentication = pkgs.lib.mkOverride 10 '' 27 #type database DBuser origin-address 28 local sameuser all peer 29 host sameuser all ::1/128 reject 30 ''; 31 32 # MkForce because something other wants to use 'localhost' 33 settings.listen_addresses = mkForce "*"; 34 35 }; 36 }; 37}