File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 129129 '' ;
130130 } ;
131131
132+ startScript = lib . mkOption {
133+ type = lib . types . lines ;
134+ description = ''
135+ PostgresSQL script to run on every startup.
136+ '' ;
137+ default = "" ;
138+ } ;
139+
140+ earlyStartScript = lib . mkOption {
141+ type = lib . types . lines ;
142+ description = ''
143+ PostgresSQL script to run on every startup, very early.
144+ '' ;
145+ default = "" ;
146+ } ;
147+
148+
132149 ensureExtensions = lib . mkOption {
133150 type = with lib . types ; attrsOf ( listOf str ) ;
134151 default = { } ;
405422 chpst -u postgres:postgres ${ cfg . package } /bin/postgres &
406423 postgresql=$!
407424
408- PSQL="chpst -u postgres:postgres ${ cfg . package } /bin/psql --port=${ cfg . port } "
425+ PSQL="chpst -u postgres:postgres ${ cfg . package } /bin/psql --port=${ cfg . port } -X "
409426 while ! $PSQL -d postgres -c "" 2> /dev/null ; do
410427 if ! kill -0 "$postgresql"; then exit 1; fi
411428 sleep 0.1
412429 done
413430
431+ $PSQL -f "${ pkgs . writeText "postgres-start-early.sql" cfg . earlyStartScript } "
432+
414433 ${ lib . concatMapStrings
415434 (
416435 { database , options } :
465484 rm -f "${ cfg . dataDir } /.first_startup"
466485 fi
467486
487+ $PSQL -f "${ pkgs . writeText "postgres-start.sql" cfg . startScript } "
488+
468489 wait $postgresql
469490 '' ;
470491 # END Copyright (c) 2003-2021 Eelco Dolstra and the Nixpkgs/NixOS contributors
You can’t perform that action at this time.
0 commit comments