2024-11-15 10:17:56 +01:00
|
|
|
|
{ pkgs, config, ... }:
|
|
|
|
|
let
|
2022-11-03 16:48:06 +01:00
|
|
|
|
keys = import ../../../variables/keys.nix;
|
|
|
|
|
passwords = import ../../../variables/passwords.crypt.nix;
|
2024-11-15 10:17:56 +01:00
|
|
|
|
in
|
|
|
|
|
{
|
2022-11-03 16:48:06 +01:00
|
|
|
|
networking.firewall.enable = true;
|
|
|
|
|
networking.firewall.allowedTCPPorts = [
|
|
|
|
|
# iperf3
|
|
|
|
|
5201
|
|
|
|
|
];
|
|
|
|
|
networking.firewall.logRefusedConnections = false;
|
|
|
|
|
|
|
|
|
|
networking.usePredictableInterfaceNames = false;
|
|
|
|
|
networking.dhcpcd = {
|
|
|
|
|
enable = true;
|
|
|
|
|
persistent = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
networking.interfaces.eth0 = {
|
|
|
|
|
useDHCP = true;
|
2023-02-07 18:24:28 +01:00
|
|
|
|
ipv6.addresses = [
|
|
|
|
|
{
|
|
|
|
|
address = "2a02:c206:3010:2066::1";
|
|
|
|
|
prefixLength = 64;
|
|
|
|
|
}
|
|
|
|
|
];
|
2022-11-03 16:48:06 +01:00
|
|
|
|
};
|
|
|
|
|
networking.defaultGateway6 = {
|
|
|
|
|
address = "fe80::1";
|
|
|
|
|
interface = "eth0";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
networking.nat = {
|
|
|
|
|
enable = true;
|
2024-11-15 10:17:56 +01:00
|
|
|
|
internalInterfaces = [ "ve-+" ];
|
2022-11-03 16:48:06 +01:00
|
|
|
|
externalInterface = "eth0";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# Kubernetes
|
|
|
|
|
# services.kubernetes.roles = ["master" "node"];
|
|
|
|
|
|
|
|
|
|
# virtualization
|
2024-11-15 10:17:56 +01:00
|
|
|
|
virtualisation = {
|
|
|
|
|
docker.enable = true;
|
|
|
|
|
};
|
2022-11-03 16:48:06 +01:00
|
|
|
|
|
|
|
|
|
services.spice-vdagentd.enable = true;
|
|
|
|
|
services.qemuGuest.enable = true;
|
|
|
|
|
|
|
|
|
|
systemd.services."sshd-status" = {
|
|
|
|
|
enable = true;
|
|
|
|
|
description = "sshd-status service";
|
2024-11-15 10:17:56 +01:00
|
|
|
|
path = [ pkgs.systemd ];
|
2022-11-03 16:48:06 +01:00
|
|
|
|
script = ''
|
|
|
|
|
systemctl status sshd | grep -i tasks
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2023-04-15 12:21:22 +02:00
|
|
|
|
# systemd.services.sshd.serviceConfig = {TasksMax = 32;};
|
2022-11-03 16:48:06 +01:00
|
|
|
|
|
2023-04-15 12:21:22 +02:00
|
|
|
|
# systemd.timers."sshd-status" = {
|
|
|
|
|
# description = "Timer to trigger sshd-status periodically";
|
|
|
|
|
# enable = true;
|
|
|
|
|
# wantedBy = ["timer.target" "multi-user.target"];
|
|
|
|
|
# timerConfig = {
|
|
|
|
|
# OnActiveSec = "5s";
|
|
|
|
|
# OnUnitActiveSec = "5s";
|
|
|
|
|
# AccuracySec = "1s";
|
|
|
|
|
# Unit = "sshd-status.service";
|
|
|
|
|
# };
|
|
|
|
|
# };
|
2022-11-03 16:48:06 +01:00
|
|
|
|
|
2024-11-15 10:17:56 +01:00
|
|
|
|
nix.gc = {
|
|
|
|
|
automatic = true;
|
|
|
|
|
};
|
2022-11-03 16:48:06 +01:00
|
|
|
|
|
|
|
|
|
boot.initrd.network = {
|
|
|
|
|
enable = true;
|
2024-11-15 10:17:56 +01:00
|
|
|
|
udhcpc.extraArgs = [ "-x hostname:${config.networking.hostName}" ];
|
2022-11-03 16:48:06 +01:00
|
|
|
|
|
|
|
|
|
ssh = {
|
|
|
|
|
enable = true;
|
|
|
|
|
authorizedKeys = keys.users.steveej.openssh;
|
|
|
|
|
hostKeys = [
|
|
|
|
|
"/etc/secrets/initrd/ssh_host_rsa_key"
|
|
|
|
|
"/etc/secrets/initrd/ssh_host_ed25519_key"
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
boot.initrd.postMountCommands = ''
|
|
|
|
|
for iface in $(cd /sys/class/net && ls); do
|
|
|
|
|
echo "Bringing down $iface..."
|
|
|
|
|
ip address flush dev $iface
|
|
|
|
|
ip link set $iface down
|
|
|
|
|
done
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
containers = {
|
|
|
|
|
backup = import ../../containers/backup.nix {
|
|
|
|
|
autoStart = false;
|
|
|
|
|
|
|
|
|
|
inherit config;
|
|
|
|
|
hostAddress = "192.168.100.16";
|
|
|
|
|
localAddress = "192.168.100.17";
|
2024-11-15 10:17:56 +01:00
|
|
|
|
subvolumes = [
|
|
|
|
|
"mailserver"
|
|
|
|
|
"webserver"
|
|
|
|
|
"backup"
|
|
|
|
|
"syncthing"
|
|
|
|
|
];
|
2022-11-03 16:48:06 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
bkpTarget = import ../../containers/backup-target.nix {
|
|
|
|
|
autoStart = false;
|
|
|
|
|
hostAddress = "192.168.100.18";
|
|
|
|
|
localAddress = "192.168.100.19";
|
|
|
|
|
containerBackupCfg = passwords.storage.backupTarget;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# 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.05"; # Did you read the comment?
|
|
|
|
|
}
|