fix nix code
This commit is contained in:
16
lib.nix
16
lib.nix
@@ -108,13 +108,15 @@ in
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
setupInitialDatabases = if initialDatabases != [] then (
|
setupInitialDatabases =
|
||||||
lib.concatMapStrings (db: ''
|
if initialDatabases != [ ] then
|
||||||
echo "Checking presence of database ${db.name}"
|
(lib.concatMapStrings (db: ''
|
||||||
dbAlreadyExists="$(echo "SELECT 1 AS result FROM pg_database WHERE datname='${db.name}';" | psql --dbname postgres | ${pkgs.gnugrep}/bin/grep -c 'exists = "1"' || true)"
|
echo "Checking presence of database ${db.name}"
|
||||||
echo $dbAlreadyExists
|
dbAlreadyExists="$(echo "SELECT 1 AS result FROM pg_database WHERE datname='${db.name}';" | psql --dbname postgres | ${pkgs.gnugrep}/bin/grep -c 'exists = "1"' || true)"
|
||||||
'') initialDatabases
|
echo $dbAlreadyExists
|
||||||
);
|
'') initialDatabases)
|
||||||
|
else
|
||||||
|
"";
|
||||||
setupScript = pkgs.writeShellApplication {
|
setupScript = pkgs.writeShellApplication {
|
||||||
name = "setup-postgres";
|
name = "setup-postgres";
|
||||||
runtimeInputs = [
|
runtimeInputs = [
|
||||||
|
|||||||
Reference in New Issue
Block a user