1
0
Fork 0
forked from fabian/nix_config
nix_config_fabian/sys/platforms/vps/default.nix

118 lines
2.4 KiB
Nix
Raw Normal View History

2024-11-21 00:52:37 +01:00
{
config,
lib,
2024-12-03 02:25:34 +01:00
pkgs,
2024-11-21 00:52:37 +01:00
flakes,
2024-12-03 02:25:34 +01:00
modulesPath,
2024-11-21 00:52:37 +01:00
...
}:
with lib; {
imports = [
flakes.vpsadminos.nixosConfigurations.container
flakes.home-manager.nixosModules.home-manager
flakes.impermanence.nixosModule
2024-12-03 02:25:34 +01:00
./hardware-configuration.nix
2024-11-21 00:52:37 +01:00
./srv
./networkMap.nix
2024-11-21 00:52:37 +01:00
];
local.sys = {
baseline.enable = true;
2024-11-21 00:52:37 +01:00
2024-12-02 21:57:33 +01:00
users.fabian = {
2024-12-03 02:25:34 +01:00
enable = true;
2024-12-03 04:07:06 +01:00
sshKeyPublicFile = [public_files/pki/fabian.ssh];
2024-12-02 21:57:33 +01:00
};
};
2025-01-23 03:18:04 +01:00
networking = {
hostName = "vps";
domain = "posixlycorrect.com";
};
2024-12-03 02:25:34 +01:00
2024-11-21 00:52:37 +01:00
services.openssh = {
settings.PasswordAuthentication = false;
};
2025-01-23 17:03:33 +01:00
programs.mosh.enable = true;
2024-11-21 00:52:37 +01:00
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {inherit flakes;};
users.fabian = {
imports = [
flakes.impermanence.nixosModules.home-manager.impermanence
"${flakes.self}/home/platforms/fabian@vps"
"${flakes.self}/home"
];
};
};
networking.firewall.allowedUDPPorts = [51820]; #TODO
systemd = {
extraConfig = ''
DefaultTimeoutStartSec=900s
'';
network = let
inherit (config.local.sys) nets;
in {
enable = true;
netdevs = {
wg-vpn = {
netdevConfig = {
Name = "wg-vpn";
Kind = "wireguard";
};
wireguardConfig = {
PrivateKeyFile = "/var/trust/wg/vpn/key.priv";
ListenPort = "51820";
};
wireguardPeers = [
{
PublicKey = "wwUp3Uu/rSxbp+6J745O+cpnZHGWOJYWfWEsTjRE3yU=";
PresharedKeyFile = "/var/trust/wg/vpn/vps-posixlycorrect.psk";
AllowedIPs = ["${nets.vpn-posixlycorrect.v6.cidr}"];
}
{
PublicKey = "YFqg/ED26KygSRSmGzvUXpwnXPqMOI3R3caVfAtHVks=";
PresharedKeyFile = "/var/trust/wg/vpn/vps-pixel8.psk";
AllowedIPs = ["${nets.vpn-pixel8.v6.cidr}"];
}
];
};
};
networks = {
wg-vpn = {
name = "wg-vpn";
networkConfig = {
Address = [
nets.vpn-vps.hosts.vps.v6.cidr
];
};
routes = [
{
Destination = nets.vpn.v6.cidr;
}
{
Source = nets.vpn.v6.cidr;
}
];
};
};
};
};
2024-11-21 00:52:37 +01:00
time.timeZone = "Europe/Amsterdam";
}