about summary refs log tree commit diff
path: root/modules/nixos/postgresql.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2024-03-31 21:29:27 +0300
committerAzat Bahawi <azat@bahawi.net>2024-03-31 21:29:27 +0300
commit9a5427e3a0c0ccf2a82dc503149a26b23fbd6004 (patch)
treef28beec29deeea36038615a8fb98a810891940b5 /modules/nixos/postgresql.nix
parent2024-03-19 (diff)
2024-03-31
Diffstat (limited to '')
-rw-r--r--modules/nixos/postgresql.nix40
1 files changed, 23 insertions, 17 deletions
diff --git a/modules/nixos/postgresql.nix b/modules/nixos/postgresql.nix
index 89b24b8..5081340 100644
--- a/modules/nixos/postgresql.nix
+++ b/modules/nixos/postgresql.nix
@@ -5,9 +5,11 @@
   this,
   ...
 }:
-with lib; let
+with lib;
+let
   cfg = config.nixfiles.modules.postgresql;
-in {
+in
+{
   options.nixfiles.modules.postgresql = {
     enable = mkEnableOption "PostgreSQL";
 
@@ -19,7 +21,7 @@ in {
 
     extraPostStart = mkOption {
       type = with types; listOf str;
-      default = [];
+      default = [ ];
       description = ''
         Additional post-startup commands.
 
@@ -37,7 +39,7 @@ in {
       }
     ];
 
-    ark.directories = [config.services.postgresql.dataDir];
+    ark.directories = [ config.services.postgresql.dataDir ];
 
     services = {
       postgresql = {
@@ -72,21 +74,25 @@ in {
       };
     };
 
-    systemd.services.postgresql.postStart = optionalString (cfg.extraPostStart != []) concatLines cfg.extraPostStart;
+    systemd.services.postgresql.postStart = optionalString (
+      cfg.extraPostStart != [ ]
+    ) concatLines cfg.extraPostStart;
 
-    environment.sessionVariables.PSQLRC = toString (pkgs.writeText "psqlrc" ''
-      \set QUIET 1
+    environment.sessionVariables.PSQLRC = toString (
+      pkgs.writeText "psqlrc" ''
+        \set QUIET 1
 
-      \timing
-      \x auto
-      \pset null '[NULL]'
-      \set PROMPT1 '%[%033[1m%]%M %n@%/%R%[%033[0m%]% λ '
-      \set PROMPT2 '    … > '
-      \set VERBOSITY verbose
-      \set HISTCONTROL ignoredups
-      \set HISTFILE /dev/null
+        \timing
+        \x auto
+        \pset null '[NULL]'
+        \set PROMPT1 '%[%033[1m%]%M %n@%/%R%[%033[0m%]% λ '
+        \set PROMPT2 '    … > '
+        \set VERBOSITY verbose
+        \set HISTCONTROL ignoredups
+        \set HISTFILE /dev/null
 
-      \unset QUIET
-    '');
+        \unset QUIET
+      ''
+    );
   };
 }

Consider giving Nix/NixOS a try! <3