From 18ef010bf1f53d3a86ed6e145fb8d88ae609f91f Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Wed, 3 Jan 2024 13:45:20 -0700 Subject: [PATCH] [NixOS] Add postgres configuration --- nixos/configuration.nix | 1 + nixos/machines/ryzen-shine.nix | 1 + nixos/postgres.nix | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 nixos/postgres.nix diff --git a/nixos/configuration.nix b/nixos/configuration.nix index ccf62a60..2e18ee03 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -24,6 +24,7 @@ ./nixified.ai.nix ./options.nix ./plasma.nix + ./postgres.nix ./secrets.nix ./ssh.nix ./syncthing.nix diff --git a/nixos/machines/ryzen-shine.nix b/nixos/machines/ryzen-shine.nix index 5c942010..5bc6582b 100644 --- a/nixos/machines/ryzen-shine.nix +++ b/nixos/machines/ryzen-shine.nix @@ -13,6 +13,7 @@ port = 3090; }; modules.gitea-runner.enable = true; + modules.postgres.enable = true; boot.loader.systemd-boot.configurationLimit = 5; diff --git a/nixos/postgres.nix b/nixos/postgres.nix new file mode 100644 index 00000000..b1b27284 --- /dev/null +++ b/nixos/postgres.nix @@ -0,0 +1,19 @@ +{ pkgs, config, makeEnable, ... }: +makeEnable config "modules.postgres" false { + services.postgresql = { + enable = true; + package = pkgs.postgresql_15; + ensureDatabases = [ "railbird" "public" ]; + authentication = pkgs.lib.mkOverride 10 '' + #type database DBuser CIDR-ADDRESS auth-method + local all all trust + host all all 0.0.0.0/0 trust + host all all ::1/128 trust + ''; + }; + services.pgadmin = { + enable = true; + initialEmail = "IvanMalison@gmail.com"; + initialPasswordFile = (builtins.toFile "password" "This is the content of the file."); + }; +}