nixos-server-config/services.nix
Michael 98b1d182fc updated 20.09 server configuration
Signed-off-by: Michael <michael.lindman@gmail.com>
2021-10-07 01:06:59 +01:00

80 lines
2.1 KiB
Nix

{ config, pkgs, ... }:
{
services = {
printing.enable = false;
openssh = {
enable = true;
ports = [ 22 ];
passwordAuthentication = false;
permitRootLogin = "no";
authorizedKeysFiles = [ ".ssh/authorized_keys" ];
challengeResponseAuthentication = false;
};
rsyncd = {
enable = true;
settings = {
storage = {
path = "/mnt/storage";
uid = "michael";
gid = "michael";
comment = "storage drive";
read_only = "no";
};
};
};
nfs.server = {
enable = true;
exports = ''
/mnt/storage 10.0.25.1(rw,nohide,no_root_squash,no_subtree_check)
/mnt/storage 10.0.25.5(rw,nohide,no_root_squash,no_subtree_check)
'';
};
samba = {
enable = true;
securityType = "user";
extraConfig = ''
workgroup WORKGROUP
server string = smbnix
netbios name = smbnix
security = user
hosts allow = 10.0.25.0 localhost
hosts deny = 0.0.0.0/0
guest account = nobody
map to guest = bad user
'';
shares = {
storage = {
path = "/srv/storage";
"read only" = false;
browseable = "yes";
"guest ok" = "no";
"create mask" = "0644";
"directory mask" = "0755";
"valid users" = "michael";
comment = "storage drive";
};
};
};
openiscsi = {
enable = true;
name = "iqn.2021-05.org.linux-iscsi.nixos";
discoverPortal = "10.0.25.1:3260";
};
cron = {
enable = true;
systemCronJobs = [
"00 7 * * * root rsync -arq --delete rsync://10.0.25.1:/forums/ /mnt/storage/backup/forum"
"00 8 * * * root rsync -arq --delete rsync://10.0.25.1/bitwarden/ /mnt/storage/backup/bitwarden"
"10 8 * * * root rsync -arq --delete rsync://10.0.25.1/opt/gitea/ /mnt/storage/backup/gitea"
"15 8 * * * root rsync -arq --delete rsync://10.0.25.1/opt/radicale/ /mnt/storage/backup/radicale"
];
};
};
}