add initdb command
This commit is contained in:
13
lib.nix
13
lib.nix
@@ -102,6 +102,17 @@ in
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
script = pkgs.writeShellApplication {
|
||||||
|
name = "run-postgres";
|
||||||
|
text = ''
|
||||||
|
if [! -d "${data_dir}"]; then
|
||||||
|
echo "Database directory does not exist. Initializing"
|
||||||
|
initdb -D ${data_dir}
|
||||||
|
fi
|
||||||
|
${package}/bin/postgres -D ${data_dir} --config-file ${configFile}
|
||||||
|
|
||||||
|
'';
|
||||||
|
};
|
||||||
in
|
in
|
||||||
# configFileCheck = pkgs.runCommand {} ''
|
# configFileCheck = pkgs.runCommand {} ''
|
||||||
# ${package}/bin/postgres -D${configFile} -C config_file
|
# ${package}/bin/postgres -D${configFile} -C config_file
|
||||||
@@ -109,7 +120,7 @@ in
|
|||||||
# '';
|
# '';
|
||||||
{
|
{
|
||||||
processes."${name}" = {
|
processes."${name}" = {
|
||||||
command = "${package}/bin/postgres -D ${data_dir} --config-file ${configFile}";
|
command = "${script}/bin/run-postgres";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user