Skip to content

Commit 7835f60

Browse files
authored
Merge pull request #262 from molybdenumsoftware/postgresql-target
chore(flake): postgresql.service -> postgresql.target
2 parents e5cfc90 + 179e1f0 commit 7835f60

File tree

4 files changed

+28
-28
lines changed

4 files changed

+28
-28
lines changed

flake.lock

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/api/nixos-module.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@
6969
systemd.services.pr-tracker-api.wantedBy = [ "multi-user.target" ];
7070
systemd.services.pr-tracker-api.after = [
7171
"network.target"
72-
] ++ lib.optional cfg.db.isLocal "postgresql.service";
73-
systemd.services.pr-tracker-api.bindsTo = lib.optional cfg.db.isLocal "postgresql.service";
72+
] ++ lib.optional cfg.db.isLocal "postgresql.target";
73+
systemd.services.pr-tracker-api.bindsTo = lib.optional cfg.db.isLocal "postgresql.target";
7474

7575
systemd.services.pr-tracker-api.script = lib.concatLines (
7676
[

modules/fetcher/nixos-module.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@
9292
systemd.services.pr-tracker-fetcher.description = "pr-tracker-fetcher";
9393
systemd.services.pr-tracker-fetcher.after = [
9494
"network.target"
95-
] ++ lib.optional cfg.db.isLocal "postgresql.service";
96-
systemd.services.pr-tracker-fetcher.requires = lib.optional cfg.db.isLocal "postgresql.service";
95+
] ++ lib.optional cfg.db.isLocal "postgresql.target";
96+
systemd.services.pr-tracker-fetcher.requires = lib.optional cfg.db.isLocal "postgresql.target";
9797
systemd.services.pr-tracker-fetcher.script = lib.concatLines (
9898
[
9999
"export ${fetcher.environmentVariables.PR_TRACKER_FETCHER_DATABASE_URL.name}=${lib.escapeShellArg "postgresql://?${attrsToURLParams cfg.db.urlParams}"}"

modules/private-nixos-modules/db.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@
9595
{
9696
config = mkIf (cfg.db.createLocally && hasAttr program cfg && programCfg.enable) {
9797
services.postgresql.ensureUsers = [ { name = programCfg.user; } ];
98-
systemd.services.postgresql.postStart = lib.mkAfter ''
99-
$PSQL '${cfg.db.name}' -c 'GRANT "${cfg.db.name}" TO "${programCfg.user}"'
100-
$PSQL '${cfg.db.name}' -c 'ALTER DEFAULT PRIVILEGES FOR ROLE "${programCfg.user}" IN SCHEMA public GRANT ALL PRIVILEGES ON TABLES TO "${cfg.db.name}"'
98+
systemd.services.postgresql-setup.postStart = ''
99+
psql '${cfg.db.name}' -c 'GRANT "${cfg.db.name}" TO "${programCfg.user}"'
100+
psql '${cfg.db.name}' -c 'ALTER DEFAULT PRIVILEGES FOR ROLE "${programCfg.user}" IN SCHEMA public GRANT ALL PRIVILEGES ON TABLES TO "${cfg.db.name}"'
101101
'';
102102
};
103103
}

0 commit comments

Comments
 (0)