Skip to content

Commit

Permalink
deploy-to-nixos: Fixed init script
Browse files Browse the repository at this point in the history
  • Loading branch information
mpscholten committed Feb 2, 2024
1 parent c4ef680 commit 79af947
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions NixSupport/nixosModules/appWithPostgres.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,10 @@ in
# Postgres
services.postgresql = {
enable = true;
ensureDatabases = [ cfg.databaseName ];
ensureUsers = [
{
name = cfg.databaseUser;
ensurePermissions = {
"DATABASE ${cfg.databaseName}" = "ALL PRIVILEGES";
};
}
];
initialScript = pkgs.writeText "ihp-initScript" ''
CREATE USER ${cfg.databaseUser};
GRANT ALL PRIVILEGES ON DATABASE ${cfg.databaseName} TO "${pkgs.databaseUser}";
CREATE DATABASE ${cfg.databaseName} OWNER ${cfg.databaseUser};
\connect ${cfg.databaseName}
CREATE TABLE IF NOT EXISTS schema_migrations (revision BIGINT NOT NULL UNIQUE);
\i ${ihp}/lib/IHP/IHPSchema.sql
Expand Down

0 comments on commit 79af947

Please sign in to comment.