Skip to content

Commit

Permalink
Merge pull request #1907 from digitallyinduced/deploy-to-nixos-fixes
Browse files Browse the repository at this point in the history
Deploy to nixos fixes
  • Loading branch information
mpscholten authored Feb 13, 2024
2 parents e1224be + c7a984c commit b712b24
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions NixSupport/nixosModules/appWithPostgres.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,12 @@ 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};
CREATE DATABASE ${cfg.databaseName} OWNER ${cfg.databaseUser};
GRANT ALL PRIVILEGES ON DATABASE ${cfg.databaseName} TO "${cfg.databaseUser}";
\connect ${cfg.databaseName}
SET ROLE '${cfg.databaseUser}';
CREATE TABLE IF NOT EXISTS schema_migrations (revision BIGINT NOT NULL UNIQUE);
\i ${ihp}/lib/IHP/IHPSchema.sql
\i ${cfg.schema}
Expand Down

0 comments on commit b712b24

Please sign in to comment.