From 2c3bd39a7e5fef2dd87448e1a747b0fee3b170ff Mon Sep 17 00:00:00 2001 From: Nikkuss Date: Mon, 17 Mar 2025 16:00:24 +0400 Subject: [PATCH] fix nix code --- lib.nix | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib.nix b/lib.nix index 4dd3cdc..586ae93 100644 --- a/lib.nix +++ b/lib.nix @@ -108,13 +108,15 @@ in ) ); }; - setupInitialDatabases = if initialDatabases != [] then ( - lib.concatMapStrings (db: '' - echo "Checking presence of database ${db.name}" - 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 $dbAlreadyExists - '') initialDatabases - ); + setupInitialDatabases = + if initialDatabases != [ ] then + (lib.concatMapStrings (db: '' + echo "Checking presence of database ${db.name}" + 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 $dbAlreadyExists + '') initialDatabases) + else + ""; setupScript = pkgs.writeShellApplication { name = "setup-postgres"; runtimeInputs = [