nix-config/hosts/leon/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

173 lines
5.5 KiB
Nix
Raw Normal View History

2022-08-25 23:38:52 +02:00
# .--.
# `. \
# \ \
# . \
# : .
# | .
# | :
# | |
# ..._ ___ | |
# `."".`''''""--..___ | |
# ,-\ \ ""-...__ _____________/ |
# / ` " ' `"""""""" .
# \ L
# (> \
#/ \
#\_ ___..---. MEOW OS \
# `--' '. \
# . \_
# _/`. `.._
# .' -. `.
# / __.-Y /''''''-...___,...--------.._ |
# / _." | / ' . \ '---..._ |
# / / / / _,. ' ,/ | |
# \_,' _.' / /'' _,-' _| |
# ' / `-----'' / |
# `...-' `...-'
#--------------------------------------------------------------------------------
2022-06-01 20:46:47 +02:00
{ zentralwerk, config, pkgs, ... }:
let
netConfig = zentralwerk.lib.config.site.net.serv;
in
{
microvm = {
2022-06-01 20:56:55 +02:00
mem = 2048;
};
2022-06-01 20:46:47 +02:00
c3d2.deployment = {
server = "nomad";
mounts = [ "etc" "home" "var"];
2022-07-07 01:21:39 +02:00
mountBase = "/glusterfs/fast/microvms/${config.networking.hostName}";
2022-06-01 20:46:47 +02:00
};
networking = {
hostName = "leon";
firewall.enable = true;
};
security.sudo = {
enable = true;
wheelNeedsPassword = false;
};
2022-08-20 04:24:53 +02:00
2022-08-07 03:47:42 +02:00
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
2022-08-20 04:24:53 +02:00
wget vim python3Full nmap htop wireguard-tools
2022-08-07 03:47:42 +02:00
];
2022-06-01 20:46:47 +02:00
users.users.leon = {
isNormalUser = true;
extraGroups = [ "wheel" ];
createHome = true;
openssh.authorizedKeys.keys = [
2022-08-20 17:16:59 +02:00
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM2zpmWA3Z9zshWaU8k1SWyJnbAyasOu9pV+9BvTY0XE leon@¯\_()_/¯"
2022-08-11 04:27:43 +02:00
];
2022-06-01 20:46:47 +02:00
};
2022-08-20 17:22:11 +02:00
networking.firewall = {
2022-08-25 23:38:52 +02:00
allowedTCPPorts = [ 5000 22 53 80 8080 ];
allowedUDPPorts = [ 5000 22 53 80 8080 8900 8900];
2022-08-20 17:22:11 +02:00
};
2022-08-20 04:24:53 +02:00
2022-08-24 05:47:49 +02:00
#-------------------------------VPN---------------------------------
# enable NAT
# networking.nat.enable = true;
# networking.nat.externalInterface = "eth0";
# networking.nat.internalInterfaces = [ "wg0" ];
# networking.firewall = {
# allowedUDPPorts = [ 51820 ];
# };
2022-08-25 23:38:52 +02:00
#_______________________________Begin-VPN1-Server____________________________________
2022-08-24 05:47:49 +02:00
networking.wireguard.interfaces = {
2022-08-25 23:38:52 +02:00
#Interface. Trusted VPN
2022-08-24 05:47:49 +02:00
vpn1 = {
#IP address && Subnet.
ips = [ "10.10.11.1/24" ];
#VPN Port.
listenPort = 8800;
# This allows the wireguard server to route your traffic to the internet and hence be like a VPN
# For this to work you have to set the dnsserver IP of your router (or dnsserver of choice) in your clients
#----------------------Start-Routing----------------------------
postSetup = ''
2022-08-25 20:18:57 +02:00
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.10.11.1/24 -o serv -j MASQUERADE
2022-08-24 05:47:49 +02:00
'';
# This undoes the above command
postShutdown = ''
2022-08-25 20:18:57 +02:00
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.10.11.1/24 -o serv -j MASQUERADE
2022-08-24 05:47:49 +02:00
'';
#----------------------End-Routing----------------------------
# Path to the private key file.
#
# Note: The private key can also be included inline via the privateKey option,
# but this makes the private key world-readable; thus, using privateKeyFile is
# recommended.
2022-08-25 02:44:31 +02:00
privateKeyFile = "/etc/wireguard/privatekey";
2022-08-24 05:47:49 +02:00
peers = [
2022-08-25 02:44:31 +02:00
# -----------------leon-Mac-------------------------.
{
publicKey = "okZuIQ90J49IJ3s+/dZyLthvo4rR2kclmTL54Ykglio=";
2022-08-24 05:47:49 +02:00
allowedIPs = [ "10.10.11.0/24" ];
}
2022-08-25 02:44:31 +02:00
];
2022-08-24 05:47:49 +02:00
};
};
2022-08-25 23:38:52 +02:00
#-----------------------------END-VPN---------------------------------
#__________________________Begin-VPN2-Server_____________________
networking.wireguard.interfaces = {
#Interface. Untrusted VPN
vpn2 = {
#IP address && Subnet.
ips = [ "10.10.100.1/24" ];
#VPN Port.
listenPort = 8900;
#----------------------Start-Routing----------------------------
#postSetup = ''
# ${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.10.100.1/24 -o serv -j MASQUERADE
#'';
2022-08-24 05:47:49 +02:00
2022-08-25 23:38:52 +02:00
# This undoes the above command
#postShutdown = ''
# ${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.10.100.1/24 -o serv -j MASQUERADE
#'';
#----------------------End-Routing----------------------------
2022-08-24 05:47:49 +02:00
2022-08-25 23:38:52 +02:00
# Path to the private key file.
#
privateKeyFile = "/etc/wireguard/privatekey";
peers = [
# -----------------leon-Mac-------------------------.
{
publicKey = "6GRIp7SjHyu5sgqudtgZdN9CKbV3GYtMnwgo06F4ylo=";
allowedIPs = [ "10.10.100.0/24" ];
}
];
};
};
2022-08-24 05:47:49 +02:00
#-----------------------------END-VPN---------------------------------
2022-08-25 23:38:52 +02:00
system.stateVersion = "22.05";
2022-06-01 20:46:47 +02:00
}