self-hosting/profiles/backend.nix

61 lines
1.4 KiB
Nix
Raw Normal View History

2021-11-25 00:59:46 +01:00
{ config, lib, pkgs, ... }:
{
imports = [
../environment.nix
../hardware/hcloud.nix
../modules/openssh.nix
../modules/nginx.nix
../modules/murmur.nix
../modules/synapse.nix
../modules/nextcloud.nix
../modules/custom-backup-job.nix
2021-12-07 08:34:21 +01:00
../modules/dokuwiki.nix
2021-11-25 00:59:46 +01:00
];
2021-11-29 02:04:29 +01:00
sops.secrets = {
borgSshKey = {
owner = config.services.borgbackup.jobs.data.user;
key = "borg/client_keys/backend1/private";
};
};
2021-11-25 00:59:46 +01:00
services.custom-backup-job = {
additionalPaths = [ "/var/lib/nextcloud/config" ];
2021-11-29 02:04:29 +01:00
readWritePaths = [ "/nix/var/data/murmur" ];
preHook = "cp /var/lib/murmur/murmur.sqlite /nix/var/data/murmur/murmur.sqlite";
2021-11-25 00:59:46 +01:00
startAt = "03:30";
2021-11-29 02:04:29 +01:00
sshKey = config.sops.secrets.borgPassphrase.path;
2021-11-25 00:59:46 +01:00
};
2021-12-07 08:34:21 +01:00
networking.interfaces.enp1s0 = {
useDHCP = true;
ipv4 = {
addresses = [
{
address = "95.216.177.3";
prefixLength = 32;
}
];
};
};
2021-11-25 00:59:46 +01:00
networking.firewall.allowedTCPPorts = [ 80 443 64738 ];
networking.firewall.allowedUDPPorts = [ 64738 ];
services.monit = {
enable = true;
config = ''
set daemon 30
with start delay 90
set httpd
port 2812
use address 127.0.0.1
allow localhost
check file nextcloud-data-mounted with path /var/lib/nextcloud/data/index.html
2021-11-29 02:04:29 +01:00
start = "${pkgs.systemd}/bin/systemctl start nextcloud-data-sshfs.service"
2021-11-25 00:59:46 +01:00
'';
};
}