Move server to new hardware
This commit is contained in:
parent
643c6c9e9b
commit
145297af58
32 changed files with 129 additions and 321 deletions
|
@ -1,4 +1,7 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||
boot.swraid = {
|
||||
enable = true;
|
||||
mdadmConf = "MAILADDR contact@nixfox.ca";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,40 +1,32 @@
|
|||
{ pkgs, ... }:
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./boot
|
||||
./disko
|
||||
./filesystems
|
||||
./firewall
|
||||
./hardware
|
||||
./users
|
||||
../../modules/system
|
||||
];
|
||||
|
||||
networking.hostName = "midas";
|
||||
networking = {
|
||||
hostName = "midas";
|
||||
hostId = "38ba3f57";
|
||||
};
|
||||
|
||||
system = {
|
||||
desktop.enable = true;
|
||||
server.enable = true;
|
||||
lanzaboote.enable = true;
|
||||
fancyboot.enable = true;
|
||||
libvirtd.enable = true;
|
||||
fileserver.enable = true;
|
||||
socialserver.enable = true;
|
||||
wireguard.server.enable = true;
|
||||
stateVersion = "24.11";
|
||||
};
|
||||
|
||||
hardware.graphics = {
|
||||
extraPackages = with pkgs; [
|
||||
intel-media-driver
|
||||
intel-ocl
|
||||
intel-vaapi-driver
|
||||
];
|
||||
extraPackages32 = with pkgs.driversi686Linux; [
|
||||
intel-media-driver
|
||||
intel-vaapi-driver
|
||||
];
|
||||
services.minecraft-servers.servers = {
|
||||
velocity.enable = true;
|
||||
cornworld.enable = true;
|
||||
skyblock.enable = true;
|
||||
};
|
||||
|
||||
nixpkgs.allowUnfreePackages = [ "intel-ocl" ];
|
||||
|
||||
services.xserver.videoDrivers = [
|
||||
"intel"
|
||||
"i915"
|
||||
];
|
||||
}
|
||||
|
|
|
@ -61,15 +61,6 @@
|
|||
mountpoint = "/nix";
|
||||
mountOptions = [ "compress=zstd" "noatime" "ssd" ];
|
||||
};
|
||||
|
||||
# Impermanence
|
||||
"/persist" = {
|
||||
mountpoint = "/persist";
|
||||
mountOptions = [ "compress=zstd" "noatime" "ssd" ];
|
||||
};
|
||||
"/persist/.snapshots" = { };
|
||||
"/persist/home/${config.sysusers.main}" = { };
|
||||
"/persist/home/${config.sysusers.main}/.snapshots" = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
{ config, ... }:
|
||||
{ ... }:
|
||||
{
|
||||
fileSystems = {
|
||||
# Network mounts
|
||||
"/home/${config.sysusers.main}/KittyNFS" = {
|
||||
device = "${config.ips.server}:/storage";
|
||||
fsType = "nfs4";
|
||||
options = [ "x-systemd.automount" "noauto" "soft" "_netdev" ];
|
||||
};
|
||||
fileSystems."/persist" = {
|
||||
device = "/dev/disk/by-uuid/acf95700-8669-45c7-9a72-bf3215b3c325";
|
||||
fsType = "btrfs";
|
||||
neededForBoot = true;
|
||||
options = [ "subvol=persist" "compress=zstd" "noatime" ];
|
||||
};
|
||||
}
|
||||
|
|
39
hosts/midas/firewall/default.nix
Normal file
39
hosts/midas/firewall/default.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
{ lib, config, ... }:
|
||||
{
|
||||
networking = {
|
||||
firewall.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.ips.luna}, ${config.secrets.ips.corn} } 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"
|
||||
}
|
||||
|
||||
chain POSTROUTING {
|
||||
type nat hook postrouting priority 100; policy accept;
|
||||
oifname "eno1" masquerade
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# Enable IP forwarding for the server configuration
|
||||
boot.kernel.sysctl."net.ipv4.ip_forward" = 1;
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
# nixos-generate-config --root ./ --no-filesystems
|
||||
{ config, lib, modulesPath, ... }:
|
||||
{
|
||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||
|
|
|
@ -1 +1 @@
|
|||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJzNzWYDUZ6PEzUPoGMA6I5t1ACUUwnucD8pNcAS1BeQ
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIFGHaxdTeC1xnTx2BY5LLR5LxhdSkmYoWuOeEuRIz0k
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
{ config, lib, ... }:
|
||||
{
|
||||
home-manager.users."${config.sysusers.main}".home = {
|
||||
desktop.enable = true;
|
||||
gaming.enable = true;
|
||||
production.enable = true;
|
||||
stateVersion = lib.mkForce config.system.stateVersion;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue