Signed-off-by: Lander Van den Bulcke <landervandenbulcke@gmail.com>
148 lines
2.8 KiB
Nix
148 lines
2.8 KiB
Nix
{ config, pkgs, ... }:
|
|
{
|
|
imports = [
|
|
./disk-config.nix
|
|
{
|
|
_module.args.disks = [ "/dev/sda" ];
|
|
}
|
|
|
|
../common/servers
|
|
];
|
|
|
|
time.timeZone = "Europe/Berlin";
|
|
|
|
networking.hostName = "hosting-02";
|
|
networking.firewall = {
|
|
enable = true;
|
|
allowedTCPPorts = [
|
|
80
|
|
443
|
|
];
|
|
allowedUDPPorts = [
|
|
51820
|
|
];
|
|
};
|
|
|
|
networking.iproute2.enable = true;
|
|
systemd.network.config = {
|
|
routeTables = {
|
|
vpn = 133;
|
|
};
|
|
addRouteTablesToIPRoute2 = true;
|
|
};
|
|
|
|
systemd.network.networks."30-wan" = {
|
|
address = [
|
|
"2a01:4f8:c013:7fc0::/64"
|
|
];
|
|
|
|
routingPolicyRules = [
|
|
{
|
|
From = "10.64.244.95/32";
|
|
Table = "vpn";
|
|
}
|
|
{
|
|
From = "fc00:bbbb:bbbb:bb01::1:f45e/128";
|
|
Table = "vpn";
|
|
}
|
|
{
|
|
User = config.users.users.vpn.uid;
|
|
Table = "vpn";
|
|
Family = "both";
|
|
}
|
|
];
|
|
};
|
|
|
|
users.groups.vpn = { };
|
|
users.users.vpn = {
|
|
isSystemUser = true;
|
|
group = "vpn";
|
|
uid = 51280;
|
|
};
|
|
|
|
networking.wireguard = {
|
|
enable = true;
|
|
|
|
interfaces.wg0 = {
|
|
ips = [
|
|
"10.64.244.95/32"
|
|
"fc00:bbbb:bbbb:bb01::1:f45e/128"
|
|
];
|
|
|
|
peers = [
|
|
{
|
|
publicKey = "KkShcqgwbkX2A9n1hhST6qu+m3ldxdJ2Lx8Eiw6mdXw=";
|
|
allowedIPs = [
|
|
"0.0.0.0/0"
|
|
"::0/0"
|
|
];
|
|
endpoint = "146.70.117.226:51820";
|
|
persistentKeepalive = 25;
|
|
}
|
|
];
|
|
|
|
listenPort = 51820;
|
|
privateKeyFile = config.sops.secrets.wireguardKey.path;
|
|
table = "133";
|
|
};
|
|
};
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
gocryptfs
|
|
sshfs
|
|
];
|
|
|
|
programs.ssh.knownHosts.storageBox = {
|
|
hostNames = [ "u491729.your-storagebox.de" ];
|
|
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIICf9svRenC/PLKIL9nk6K/pxQgoiFC41wTNvoIncOxs";
|
|
};
|
|
|
|
fileSystems."/mnt/box" = {
|
|
device = "u491729@u491729.your-storagebox.de:/home";
|
|
fsType = "fuse.sshfs";
|
|
options = [
|
|
"defaults"
|
|
"_netdev"
|
|
"allow_other"
|
|
"default_permissions"
|
|
"port=23"
|
|
"compression=no"
|
|
"reconnect"
|
|
"ServerAliveInterval=15"
|
|
"IdentityFile=${config.sops.secrets.storageboxKey.path}"
|
|
];
|
|
};
|
|
|
|
fileSystems."/data" = {
|
|
depends = [
|
|
"/mnt/box"
|
|
];
|
|
device = "/mnt/box/crypt";
|
|
fsType = "fuse.gocryptfs";
|
|
options = [
|
|
"rw"
|
|
"allow_other"
|
|
"passfile=${config.sops.secrets.storageboxCryptKey.path}"
|
|
];
|
|
};
|
|
|
|
sops.secrets = {
|
|
wireguardKey = {
|
|
owner = "root";
|
|
sopsFile = ./secrets.yaml;
|
|
};
|
|
storageboxKey = {
|
|
owner = "root";
|
|
sopsFile = ./secrets.yaml;
|
|
};
|
|
storageboxCryptKey = {
|
|
owner = "root";
|
|
sopsFile = ./secrets.yaml;
|
|
};
|
|
};
|
|
|
|
security.acme.defaults.email = "landervandenbulcke@gmail.com";
|
|
security.acme.acceptTerms = true;
|
|
|
|
system.stateVersion = "25.05";
|
|
}
|