moved postgres to it's own file

This commit is contained in:
Nickiel12 2024-07-12 01:30:41 +00:00
parent 958128e86e
commit e18d2a06f7
3 changed files with 88 additions and 84 deletions

View file

@ -16,6 +16,7 @@
./modules/nginx.nix ./modules/nginx.nix
./modules/nextcloud.nix ./modules/nextcloud.nix
./modules/nicks_nextcould_integrations.nix ./modules/nicks_nextcould_integrations.nix
./modules/postgres.nix
./modules/protonvpn.nix ./modules/protonvpn.nix
./modules/tailscale.nix ./modules/tailscale.nix
./modules/vaultwarden.nix ./modules/vaultwarden.nix

View file

@ -1,97 +1,78 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
services.nextcloud = { services.nextcloud = {
enable = true; enable = true;
package = pkgs.nextcloud29; package = pkgs.nextcloud29;
enableImagemagick = true; enableImagemagick = true;
nginx.recommendedHttpHeaders = true; nginx.recommendedHttpHeaders = true;
https = true; https = true;
hostName = "files.nickiel.net"; hostName = "files.nickiel.net";
home = "/Aurora/nextcloud"; home = "/Aurora/nextcloud";
autoUpdateApps.enable = true; autoUpdateApps.enable = true;
phpOptions = { phpOptions = {
"opcache.interned_strings_buffer" = "64"; "opcache.interned_strings_buffer" = "64";
}; };
settings = { settings = {
preview_max_x = 2048; preview_max_x = 2048;
preview_max_y = 2048; preview_max_y = 2048;
jpeg_quality = 50; jpeg_quality = 50;
enable_previews = true; enable_previews = true;
enabledPreviewProviders = [ enabledPreviewProviders = [
"OC\\Preview\\HEIC" "OC\\Preview\\HEIC"
"OC\\Preview\\JPEG" "OC\\Preview\\JPEG"
"OC\\Preview\\JPG" "OC\\Preview\\JPG"
"OC\\Preview\\PNG" "OC\\Preview\\PNG"
"OC\\Preview\\MP4" "OC\\Preview\\MP4"
"OC\\Preview\\MOVIE" "OC\\Preview\\MOVIE"
]; ];
log_type = "file"; log_type = "file";
maintenance_window_start = "10"; # 3 AM PDT maintenance_window_start = "10"; # 3 AM PDT
default_phone_region = "US"; default_phone_region = "US";
overwriteProtocol = "https"; overwriteProtocol = "https";
extraTrustedDomains = [ extraTrustedDomains = [
"10.0.0.183" "10.0.0.183"
"files.nickiel.net" "files.nickiel.net"
]; ];
trustedProxies = [ trustedProxies = [
"files.nickiel.net" "files.nickiel.net"
]; ];
}; };
database.createLocally = false; database.createLocally = false;
config = { config = {
dbtype = "pgsql"; dbtype = "pgsql";
dbuser = "nextcloud"; dbuser = "nextcloud";
dbhost = "/run/postgresql"; dbhost = "/run/postgresql";
dbname = "nextcloud"; dbname = "nextcloud";
#dbpassFile = "/Aurora/nextcloud/nextcloud-db-password"; #dbpassFile = "/Aurora/nextcloud/nextcloud-db-password";
# This doesn't seem to be working, see this documation: # This doesn't seem to be working, see this documation:
# https://docs.nextcloud.com/server/latest/admin_manual/configuration_user/reset_admin_password.html # https://docs.nextcloud.com/server/latest/admin_manual/configuration_user/reset_admin_password.html
adminpassFile = "/Aurora/nextcloud/nextcloud-admin-password"; adminpassFile = "/Aurora/nextcloud/nextcloud-admin-password";
adminuser = "admin"; adminuser = "admin";
}; };
}; };
services.postgresql = { # Make sure PostSQL is running before nextcloud
enable = true; systemd.services."nextcloud-setup" = {
enableTCPIP = true; requires = ["postgresql.service"];
ensureDatabases = [ "nextcloud" ]; after = ["postgresql.service"];
ensureUsers = [ };
{
name = "nextcloud";
ensureDBOwnership = true;
}
];
authentication = lib.mkForce ''
# TYPE DATABASE USER ADDRESS METHOD
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
host all all 0.0.0.0/0 md5
''; # address is the computer you are connecting from
};
# Make sure PostSQL is running before nextcloud systemd.services.nextcloud-preview = {
systemd.services."nextcloud-setup" = { description = "Generate previews for all images that haven't been rendered";
requires = ["postgresql.service"]; path = with pkgs; [
after = ["postgresql.service"]; config.services.nextcloud.occ
}; ];
script = ''
systemd.services.nextcloud-preview = { nextcloud-occ preview:pre-generate
description = "Generate previews for all images that haven't been rendered"; '';
path = with pkgs; [ startAt = "01:00:00";
config.services.nextcloud.occ };
];
script = ''
nextcloud-occ preview:pre-generate
'';
startAt = "01:00:00";
};
} }

View file

@ -0,0 +1,22 @@
{ config, lib, pkgs, ... }:
{
services.postgresql = {
enable = true;
enableTCPIP = true;
ensureDatabases = [ "nextcloud" ];
ensureUsers = [
{
name = "nextcloud";
ensureDBOwnership = true;
}
];
authentication = lib.mkForce ''
# TYPE DATABASE USER ADDRESS METHOD
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
host all all 0.0.0.0/0 md5
''; # address is the computer you are connecting from
};
}