2024-01-18 21:06:45 +00:00
|
|
|
|
{
|
2024-02-08 20:53:22 +01:00
|
|
|
|
pkgs,
|
|
|
|
|
lib,
|
|
|
|
|
config,
|
|
|
|
|
repoFlake,
|
2024-06-01 21:46:09 +02:00
|
|
|
|
nodeFlake,
|
2024-02-08 20:53:22 +01:00
|
|
|
|
nodeName,
|
|
|
|
|
...
|
|
|
|
|
}: {
|
2024-01-18 21:06:45 +00:00
|
|
|
|
imports = [
|
|
|
|
|
../../snippets/systemd-resolved.nix
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
networking.firewall.enable = true;
|
|
|
|
|
networking.nftables.enable = true;
|
|
|
|
|
|
|
|
|
|
networking.firewall.allowedTCPPorts = [
|
|
|
|
|
# iperf3
|
|
|
|
|
5201
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
networking.firewall.logRefusedConnections = false;
|
|
|
|
|
|
|
|
|
|
networking.usePredictableInterfaceNames = false;
|
|
|
|
|
|
|
|
|
|
networking.useNetworkd = true;
|
|
|
|
|
networking.useDHCP = true;
|
|
|
|
|
|
|
|
|
|
networking.nat = {
|
|
|
|
|
enable = true;
|
2024-02-08 20:53:22 +01:00
|
|
|
|
internalInterfaces = ["ve-*"];
|
2024-01-18 21:06:45 +00:00
|
|
|
|
externalInterface = "eth0";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# virtualization
|
2024-02-08 20:53:22 +01:00
|
|
|
|
virtualisation = {docker.enable = false;};
|
2024-01-18 21:06:45 +00:00
|
|
|
|
|
2024-02-08 20:53:22 +01:00
|
|
|
|
nix.gc = {automatic = true;};
|
2024-01-18 21:06:45 +00:00
|
|
|
|
|
|
|
|
|
sops.secrets.restic-password.sopsFile = ../../../../secrets/${nodeName}/secrets.yaml;
|
|
|
|
|
|
|
|
|
|
# adapted from https://github.com/lilyinstarlight/foosteros/blob/5c75ded111878970fd4f600c7adc013f971d5e71/config/restic.nix
|
2024-02-08 20:53:22 +01:00
|
|
|
|
services.restic.backups.${nodeName} = let
|
|
|
|
|
btrfs = "${pkgs.btrfs-progs}/bin/btrfs";
|
|
|
|
|
in {
|
|
|
|
|
initialize = true;
|
|
|
|
|
repository = "sftp://u217879-sub3@u217879-sub3.your-storagebox.de:23/restic/${nodeName}";
|
|
|
|
|
|
|
|
|
|
paths = [
|
|
|
|
|
"/backup"
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
pruneOpts = [
|
|
|
|
|
"--keep-daily 7"
|
|
|
|
|
"--keep-weekly 5"
|
|
|
|
|
"--keep-monthly 12"
|
|
|
|
|
"--keep-yearly 2"
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
timerConfig = {
|
|
|
|
|
OnCalendar = lib.mkDefault "daily";
|
|
|
|
|
Persistent = true;
|
|
|
|
|
};
|
2024-01-18 21:06:45 +00:00
|
|
|
|
|
2024-02-08 20:53:22 +01:00
|
|
|
|
passwordFile = config.sops.secrets.restic-password.path;
|
2024-01-18 21:06:45 +00:00
|
|
|
|
|
2024-02-08 20:53:22 +01:00
|
|
|
|
backupPrepareCommand = ''
|
|
|
|
|
${btrfs} su snapshot -r /var/lib/container-volumes /backup/container-volumes
|
|
|
|
|
'';
|
|
|
|
|
backupCleanupCommand = ''
|
|
|
|
|
${btrfs} su delete /backup/container-volumes
|
|
|
|
|
'';
|
|
|
|
|
};
|
2024-01-18 21:06:45 +00:00
|
|
|
|
|
|
|
|
|
containers = {
|
|
|
|
|
mailserver = import ../../containers/mailserver.nix {
|
2024-06-01 21:46:09 +02:00
|
|
|
|
specialArgs = {
|
|
|
|
|
inherit repoFlake nodeFlake;
|
|
|
|
|
};
|
2024-01-18 21:06:45 +00:00
|
|
|
|
|
|
|
|
|
autoStart = true;
|
|
|
|
|
|
|
|
|
|
hostAddress = "192.168.100.10";
|
|
|
|
|
localAddress = "192.168.100.11";
|
|
|
|
|
|
|
|
|
|
imapsPort = 993;
|
|
|
|
|
sievePort = 4190;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
webserver =
|
|
|
|
|
import ../../containers/webserver.nix
|
2024-02-08 20:53:22 +01:00
|
|
|
|
{
|
2024-06-01 21:46:09 +02:00
|
|
|
|
specialArgs = {
|
|
|
|
|
inherit repoFlake nodeFlake;
|
|
|
|
|
};
|
2024-01-18 21:06:45 +00:00
|
|
|
|
|
2024-02-08 20:53:22 +01:00
|
|
|
|
autoStart = true;
|
2024-01-18 21:06:45 +00:00
|
|
|
|
|
2024-02-08 20:53:22 +01:00
|
|
|
|
hostAddress = "192.168.100.12";
|
|
|
|
|
localAddress = "192.168.100.13";
|
2024-01-18 21:06:45 +00:00
|
|
|
|
|
2024-02-08 20:53:22 +01:00
|
|
|
|
httpPort = 80;
|
|
|
|
|
httpsPort = 443;
|
|
|
|
|
};
|
2024-01-18 21:06:45 +00:00
|
|
|
|
|
|
|
|
|
syncthing = import ../../containers/syncthing.nix {
|
2024-06-01 21:46:09 +02:00
|
|
|
|
specialArgs = {
|
|
|
|
|
inherit repoFlake nodeFlake;
|
|
|
|
|
};
|
2024-01-18 21:06:45 +00:00
|
|
|
|
autoStart = true;
|
|
|
|
|
|
|
|
|
|
hostAddress = "192.168.100.14";
|
|
|
|
|
localAddress = "192.168.100.15";
|
|
|
|
|
|
|
|
|
|
syncthingPort = 22000;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# This value determines the NixOS release from which the default
|
|
|
|
|
# settings for stateful data, like file locations and database versions
|
|
|
|
|
# on your system were taken. It‘s perfectly fine and recommended to leave
|
|
|
|
|
# this value at the release version of the first install of this system.
|
|
|
|
|
# Before changing this value read the documentation for this option
|
|
|
|
|
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
|
|
|
|
system.stateVersion = "22.11"; # Did you read the comment?
|
|
|
|
|
}
|