unit/modules/datasync.nix

74 lines
1.7 KiB
Nix

{ config, lib, pkgs, ... }:
{
# Samba configuration
environment.systemPackages = with pkgs; [ samba ];
services.samba = {
enable = true;
nsswins = true;
syncPasswordsByPam = true;
extraConfig = ''
workgroup = WORKGROUP
server string = unit
netbios name = unit
guest account = nobody
map to guest = bad user
load printers=no
smb encrypt = required
server min protocol = SMB2_10
client min protocol = SMB2
client max protocol = SMB3
ntlm auth = yes
'';
shares.public = {
path = "/vault/samba/CSD";
browseable = "yes";
"read only" = "no";
"guest ok" = "yes";
"create mask" = "0644";
"directory mask" = "0755";
"force user" = "coace";
};
};
# ZFS automatic backup solution
services.znapzend = {
enable = true;
pure = true;
zetup."vault" = {
plan = "1h=>10min,1d=>1h,1w=>1d,1m=>1w,1y=>1m";
recursive = true;
destinations.backup = {
host = "10.0.1.4";
dataset = "shield/unit";
plan = "1w=>1d,1m=>1w,1y=>1m";
};
};
};
# Nextcloud configuration
services.nextcloud = {
enable = true;
package = pkgs.nextcloud21;
home = "/vault/nextcloud";
hostName = "nextcloud.coace.duckdns.org";
https = true;
autoUpdateApps = {
enable = true;
startAt = "Sun 05:00:00";
};
config = {
overwriteProtocol = "https";
dbtype = "pgsql";
dbuser = "nextcloud";
dbname = "nextcloud";
dbpassFile = "/var/keys/nextcloud";
adminpassFile = "/var/keys/nextcloud-admin";
adminuser = "admin";
defaultPhoneRegion = "ES";
};
};
}