refactor: config/hosts => hosts
This commit is contained in:
152
hosts/imxyy-nix-server/nextcloud.nix
Normal file
152
hosts/imxyy-nix-server/nextcloud.nix
Normal file
@@ -0,0 +1,152 @@
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
hostname,
|
||||
...
|
||||
}:
|
||||
let
|
||||
nextcloud = "nextcloud.${imxyy}";
|
||||
imxyy = "imxyy.top";
|
||||
in
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
exiftool
|
||||
ffmpeg
|
||||
rclone
|
||||
];
|
||||
|
||||
services.nextcloud = {
|
||||
enable = true;
|
||||
package = pkgs.nextcloud32;
|
||||
extraApps = {
|
||||
inherit (pkgs.nextcloud32.packages.apps)
|
||||
bookmarks
|
||||
previewgenerator
|
||||
spreed
|
||||
notes
|
||||
registration
|
||||
;
|
||||
};
|
||||
extraAppsEnable = true;
|
||||
hostName = nextcloud;
|
||||
home = "/mnt/nas/nextcloud";
|
||||
https = true;
|
||||
caching.redis = true;
|
||||
configureRedis = true;
|
||||
database.createLocally = true;
|
||||
notify_push.enable = true;
|
||||
config = {
|
||||
dbtype = "pgsql";
|
||||
adminpassFile = toString (pkgs.writeText "nextcloud-pass" "admin12345!");
|
||||
adminuser = "admin";
|
||||
};
|
||||
settings = {
|
||||
trusted_domains = [
|
||||
hostname
|
||||
"192.168.3.2"
|
||||
"10.0.0.1"
|
||||
];
|
||||
trusted_proxies = [
|
||||
"127.0.0.1"
|
||||
"192.168.3.0/24"
|
||||
];
|
||||
};
|
||||
phpExtraExtensions =
|
||||
all: with all; [
|
||||
pdlib
|
||||
];
|
||||
maxUploadSize = "16G";
|
||||
phpOptions = {
|
||||
"opcache.enable" = 1;
|
||||
"opcache.enable_cli" = 1;
|
||||
"opcache.interned_strings_buffer" = 23;
|
||||
"opcache.max_accelerated_files" = 10000;
|
||||
"opcache.memory_consumption" = 128;
|
||||
"opcache.save_comments" = 1;
|
||||
"opcache.revalidate_freq" = 1;
|
||||
memory_limit = lib.mkForce "2G";
|
||||
};
|
||||
poolSettings = {
|
||||
pm = "dynamic";
|
||||
"pm.max_children" = "12";
|
||||
"pm.min_spare_servers" = "6";
|
||||
"pm.max_spare_servers" = "12";
|
||||
};
|
||||
};
|
||||
services.nginx.virtualHosts."nextcloud.imxyy.top" = {
|
||||
listen = [
|
||||
{
|
||||
addr = "0.0.0.0";
|
||||
port = 8084;
|
||||
}
|
||||
];
|
||||
};
|
||||
/*
|
||||
services.caddy.virtualHosts.":80" = {
|
||||
extraConfig = ''
|
||||
redir https://{host}{uri}
|
||||
'';
|
||||
};
|
||||
services.caddy.virtualHosts.":443" = {
|
||||
extraConfig =
|
||||
let
|
||||
path = "/var/lib/caddy/.local/share/caddy/certificates/acme-v02.api.letsencrypt.org-directory/nextcloud.imxyy.top";
|
||||
in
|
||||
''
|
||||
reverse_proxy :8084
|
||||
tls ${path}/nextcloud.imxyy.top.crt ${path}/nextcloud.imxyy.top.key
|
||||
'';
|
||||
};
|
||||
*/
|
||||
services.caddy.virtualHosts."nextcloud.imxyy.top" = {
|
||||
extraConfig = ''
|
||||
reverse_proxy http://127.0.0.1:8084 {
|
||||
trusted_proxies 192.168.3.0/24
|
||||
}
|
||||
|
||||
redir /.well-known/carddav /remote.php/dav/ 301
|
||||
redir /.well-known/caldav /remote.php/dav/ 301
|
||||
'';
|
||||
};
|
||||
|
||||
/*
|
||||
systemd.timers."kopia" = {
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
OnCalendar = "daily";
|
||||
Persistent = true;
|
||||
Unit = "kopia.service";
|
||||
};
|
||||
};
|
||||
*/
|
||||
|
||||
systemd.services."kopia" = {
|
||||
script = ''
|
||||
${pkgs.kopia}/bin/kopia snapshot create /mnt/nas/share
|
||||
${pkgs.kopia}/bin/kopia snapshot create /mnt/nas/nextcloud/data
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "nextcloud";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.timers."nextcloud-cronjobs" = {
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
OnCalendar = "daily";
|
||||
Persistent = true;
|
||||
Unit = "nextcloud-cronjobs.service";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services."nextcloud-cronjobs" = {
|
||||
script = ''
|
||||
/run/current-system/sw/bin/nextcloud-occ preview:pre-generate
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "nextcloud";
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user