Rename some hostnames

This commit is contained in:
Jimbo 2024-11-12 04:25:51 -05:00
parent bbf0696221
commit 17f2a16f48
51 changed files with 175 additions and 281 deletions

25
hosts/kitty/default.nix Normal file
View file

@ -0,0 +1,25 @@
{ ... }:
{
imports = [
./hardware
# Apps and programs
../../../modules/system
../../../modules/system/accounts
../../../modules/system/devices/filesystems
../../../modules/system/devices/boot/systemd
../../../modules/system/devices/networking
../../../modules/system/devices/networking/firewall/server
../../../modules/system/devices/networking/wireguard/server
../../../modules/system/programs/git
../../../modules/system/programs/security
../../../modules/system/services/common
../../../modules/system/services/server
# Misc
../../../overlays
../../../variables
];
networking.hostName = "kitty";
}

View file

@ -0,0 +1,45 @@
{ lib, config, ... }:
{
networking = {
firewall = {
allowPing = false;
extraInputRules = ''
ip saddr { ${config.ips.localSpan}.0/24, 10.100.0.0/24 } tcp dport 2049 accept comment "Accept NFS"
ip saddr { ${config.ips.pc}, ${config.secrets.lunaIP}, ${config.secrets.cornIP} } tcp dport { 1935, 1945 } accept comment "Accept RTMP"
'';
};
# Nftables configuration only if server is enabled
nftables.tables.forwarding = {
family = "ip";
content = ''
chain PREROUTING {
type nat hook prerouting priority dstnat; policy accept;
tcp dport 2211 dnat to ${config.ips.pc}:22 comment "SSH to PC"
tcp dport 2222 dnat to 10.100.0.19:22 comment "SSH to Oracle VM"
udp dport { 27005, 27015, 7777 } dnat to ${config.ips.pc} comment "PC Hosted Games"
tcp dport { 48010, 47989, 47984 } dnat to ${config.ips.pc} comment "PC Sunshine TCP"
udp dport { 47998, 47999, 48000 } dnat to ${config.ips.pc} comment "PC Sunshine UDP"
tcp dport { 38010, 37989, 37984 } dnat to ${config.ips.vm} comment "VM Sunshine TCP"
udp dport { 37998, 37999, 38000 } dnat to ${config.ips.vm} comment "VM Sunshine UDP"
udp dport { 7790, 7791, 7792 } dnat to ${config.ips.hx} comment "Deus Ex"
ip saddr ${config.secrets.cornIP} tcp dport { 9943, 9944 } dnat to ${config.ips.vm} comment "VM ALVR TCP"
ip saddr ${config.secrets.cornIP} udp dport { 9943, 9944 } dnat to ${config.ips.vm} comment "VM ALVR UDP"
}
chain POSTROUTING {
type nat hook postrouting priority 100; policy accept;
oifname "${config.ips.netInt}" masquerade
}
'';
};
};
# Enable IP forwarding for the server configuration
boot.kernel.sysctl."net.ipv4.ip_forward" = lib.mkIf config.system.firewall.server.enable 1;
}

View file

@ -0,0 +1,100 @@
{ config, lib, pkgs, modulesPath, ... }:
{
boot = {
blacklistedKernelModules = [
"pcspkr"
];
initrd = {
availableKernelModules = [
"xhci_pci"
"ehci_pci"
"ahci"
"nvme"
"usbhid"
"sd_mod"
"sr_mod"
];
kernelModules = [
"kvm-intel"
];
};
swraid = {
enable = true;
mdadmConf = "MAILADDR jimbo@${config.domains.jim2}";
};
};
# Main root
fileSystems = {
"/" = {
device = "/dev/server/root";
fsType = "btrfs";
options = [ "subvol=@" ];
};
"/home" = {
device = "/dev/server/root";
fsType = "btrfs";
options = [ "subvol=@home" ];
};
"/nix" = {
device = "/dev/server/root";
fsType = "btrfs";
options = [ "subvol=@nix" ];
};
"/var" = {
device = "/dev/server/root";
fsType = "btrfs";
options = [ "subvol=@var" ];
};
"/srv/minecraft" = {
device = "/dev/server/root";
fsType = "btrfs";
options = [ "subvol=@minecraft" "compress=zstd" ];
};
"/boot" = {
device = "/dev/disk/by-uuid/CD94-1D3F";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
# Files
"/export/JimboNFS/Downloads" = {
device = "/dev/server/root";
fsType = "btrfs";
options = [ "subvol=@downloads" "compress=zstd" ];
};
"/export/JimboNFS/Documents" = {
device = "/dev/server/root";
fsType = "btrfs";
options = [ "subvol=@docs" "compress=zstd" ];
};
# Media
"/export/JimboNFS/Photos" = {
device = "/dev/server/root";
fsType = "btrfs";
options = [ "subvol=@photos" "compress=zstd" ];
};
"/export/JimboNFS/Videos" = {
device = "/dev/server/root";
fsType = "btrfs";
options = [ "subvol=@videos" "compress=zstd" ];
};
# Music
"/export/JimboNFS/Music" = {
device = "/dev/server/root";
fsType = "btrfs";
options = [ "subvol=@music" "compress=zstd" ];
};
};
swapDevices = [
{ device = "/dev/server/root/swap"; }
];
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIKC8Uqxb09V3msBgDv6lD/nETMYr/X0OgtpDo8ldcMK

View file

@ -0,0 +1,28 @@
{ lib, config, ... }:
{
networking = {
firewall.allowedUDPPorts = [ 51820 ];
nat = {
enable = config.system.wireguard.server.enable;
externalInterface = "eno1";
internalInterfaces = [ "wgs" ];
};
wireguard.interfaces.wgs = {
ips = [ "10.100.0.1/24" ];
listenPort = 51820;
privateKey = config.secrets.wgServerPriv;
peers = [
{ # NixOS Config Key
publicKey = "OKUH/h6YSURI4vgeTZKQD15QsqaygdbTn1mAWzQp9S0=";
allowedIPs = [ "10.100.0.16/28" ];
}
{ # Pixel 9
publicKey = "dPCtjm67adMZCnyL1O2L+uUOk0RbjA9T/tht1r+qcE4=";
allowedIPs = [ "10.100.0.2/32" ];
}
];
};
};
}