refactor: cleaned up nixos dir

This commit is contained in:
Nick 2025-02-05 20:15:36 -06:00
parent 89814be57c
commit 2000adb56a
77 changed files with 422 additions and 464 deletions

View file

@ -0,0 +1,60 @@
{ flake, ... }:
let
inherit (flake.config.machines.devices)
server
;
inherit (flake.config.services.instances)
postgresql
;
service = postgresql;
in
{
services = {
postgresqlBackup = {
enable = true;
location = service.paths.path0;
databases = [
"mastodon"
"nextcloud"
"peertube"
"forgejo"
];
};
postgresql = {
enable = true;
};
};
networking = {
firewall = {
allowedTCPPorts = [
service.ports.port0
];
};
};
fileSystems."/var/lib/postgresql" = {
device = service.paths.path0;
fsType = "none";
options = [
"bind"
];
depends = [
server.storage0.mount
];
};
systemd.tmpfiles.rules = [
"Z ${service.paths.path0} 700 ${service.name} ${service.name} -"
];
users.users.${service.name}.extraGroups = [
"nextcloud"
"mastodon"
"forgejo"
];
system.activationScripts.postgresCommands = ''
chown -R ${service.name}:${service.name} ${service.paths.path0}
'';
}