tsuki: use `ensureDBOwnership` for postgres for nixos 24.05 migration

This commit is contained in:
Oystein Kristoffer Tveit 2024-06-10 00:43:04 +02:00
parent 68bf2cd1b0
commit 9187a62d6f
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
6 changed files with 15 additions and 32 deletions

View File

@ -55,14 +55,10 @@ in {
services.postgresql = lib.mkIf cfg.enable { services.postgresql = lib.mkIf cfg.enable {
enable = true; enable = true;
ensureDatabases = [ "headscale" ]; ensureDatabases = [ "headscale" ];
ensureUsers = [ ensureUsers = [{
(rec {
name = "headscale"; name = "headscale";
ensurePermissions = { ensureDBOwnership = true;
"DATABASE \"${name}\"" = "ALL PRIVILEGES"; }];
};
})
];
}; };
environment.systemPackages = lib.mkIf cfg.enable [ pkgs.headscale ]; environment.systemPackages = lib.mkIf cfg.enable [ pkgs.headscale ];

View File

@ -53,11 +53,10 @@ in {
services.postgresql = { services.postgresql = {
ensureDatabases = [ "hedgedoc" ]; ensureDatabases = [ "hedgedoc" ];
ensureUsers = [{ ensureUsers = [{
name = "hedgedoc"; name = "hedgedoc";
ensurePermissions = { ensureDBOwnership = true;
"DATABASE \"hedgedoc\"" = "ALL PRIVILEGES";
};
}]; }];
}; };

View File

@ -5,9 +5,7 @@
cfg = config.services; cfg = config.services;
db = name: { db = name: {
inherit name; inherit name;
ensurePermissions = { ensureDBOwnership = true;
"DATABASE \"${name}\"" = "ALL PRIVILEGES";
};
}; };
in { in {
enable = true; enable = true;

View File

@ -170,9 +170,7 @@ in
o = lib.optional; o = lib.optional;
db = name: { db = name: {
inherit name; inherit name;
ensurePermissions = { ensureDBOwnership = true;
"DATABASE \"${name}\"" = "ALL PRIVILEGES";
};
}; };
in { in {
enable = true; enable = true;

View File

@ -58,13 +58,9 @@
services.postgresql = { services.postgresql = {
enable = true; enable = true;
ensureDatabases = [ "nextcloud" ]; ensureDatabases = [ "nextcloud" ];
ensureUsers = [ ensureUsers = [{
(rec {
name = "nextcloud"; name = "nextcloud";
ensurePermissions = { ensureDBOwnership = true;
"DATABASE \"${name}\"" = "ALL PRIVILEGES"; }];
};
})
];
}; };
} }

View File

@ -59,14 +59,10 @@ in {
services.postgresql = lib.mkIf cfg.enable { services.postgresql = lib.mkIf cfg.enable {
enable = true; enable = true;
ensureDatabases = [ "vaultwarden" ]; ensureDatabases = [ "vaultwarden" ];
ensureUsers = [ ensureUsers = [{
(rec {
name = "vaultwarden"; name = "vaultwarden";
ensurePermissions = { ensureDBOwnership = true;
"DATABASE \"${name}\"" = "ALL PRIVILEGES"; }];
};
})
];
}; };
local.socketActivation.vaultwarden = { local.socketActivation.vaultwarden = {