fix script

This commit is contained in:
2025-03-17 13:38:21 +04:00
parent c7d116be87
commit f5ab052719

12
lib.nix
View File

@@ -108,9 +108,14 @@ in
) )
); );
}; };
setupScript = pkgs.writeShellScriptBin "setup-postgres" '' setupScript = pkgs.writeShellApplication {
set -euo pipefail name = "setup-postgres";
export PATH=${package}/bin:${pkgs.coreutils}/bin runtimeInputs = [
package
pkgs.coreutils
pkgs.gnused
];
text = ''
POSTGRES_RUN_INITIAL_SCRIPT="false" POSTGRES_RUN_INITIAL_SCRIPT="false"
if [[ ! -d "$PGDATA" ]]; then if [[ ! -d "$PGDATA" ]]; then
initdb --no-instructions initdb --no-instructions
@@ -134,6 +139,7 @@ in
unset POSTGRES_RUN_INITIAL_SCRIPT unset POSTGRES_RUN_INITIAL_SCRIPT
''; '';
};
script = pkgs.writeShellApplication { script = pkgs.writeShellApplication {
name = "run-postgres"; name = "run-postgres";