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

View file

@ -74,17 +74,16 @@
in { in {
# nixos-rebuild switch --flake /etc/nixos#hostname # nixos-rebuild switch --flake /etc/nixos#hostname
nixosConfigurations = { nixosConfigurations = {
firefly = mkNix [ ./hosts/firefly ]; # Main Desktop tower = mkNix [ ./hosts/tower ]; # Main Desktop
detritus = mkNix [ ./hosts/detritus ]; # Acer Desktop
shuttle = mkNix [ ./hosts/shuttleworth ]; # Pinebook Pro
lacros = mkNix [ ./hosts/lacros ]; # Dell Chromebook lacros = mkNix [ ./hosts/lacros ]; # Dell Chromebook
redmond = mkNix [ ./hosts/redmond ]; # Lenovo Dual-Boot Laptop redmond = mkNix [ ./hosts/redmond ]; # Lenovo Dual-Boot Laptop
treefruit = mkNix [ ./hosts/treefruit ]; # Macbook Pro 14,1 pomme = mkNix [ ./hosts/treefruit ]; # Macbook Pro 14,1
leash = mkNix [ ./hosts/leash ]; # Portable Hard-Drive extern = mkNix [ ./hosts/extern ]; # Portable Hard-Drive
cyberspark = mkNix [ ./hosts/cyberspark ]; # Dell Optiplex 7010 kitty = mkNix [ ./hosts/kitty ]; # Dell Optiplex 7010
bomberman = mkNix [ ./hosts/bomberman ]; # Oracle ARM xenia = mkNix [ ./hosts/xenia ]; # Acer Veriton X2611G
prophet = mkNix [ ./hosts/prophet ]; # Oracle Neoverse-N1
}; };
# home-manager switch --flake /etc/nixos#username # home-manager switch --flake /etc/nixos#username

View file

@ -1,15 +0,0 @@
{ ... }:
{
imports = [
../../../modules/home/users
../../../modules/home/settings/nix
../../../modules/home/programs/misc/headless
../../../modules/home/programs/terminal/fastfetch
../../../modules/home/programs/terminal/git
../../../modules/home/programs/terminal/neovim
../../../modules/home/programs/terminal/ranger
../../../modules/home/programs/terminal/tmux
../../../modules/home/programs/terminal/zsh
../../../variables/domains
];
}

View file

@ -1,7 +1,7 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
boot = { boot = {
kernelPackages = pkgs.unstable.linuxPackages_latest; kernelPackages = pkgs.linuxPackages_5_10;
kernel.sysctl."vm.max_map_count" = 2147483642; kernel.sysctl."vm.max_map_count" = 2147483642;
kernelParams = [ kernelParams = [
"nvidia_drm.fbdev=1" "nvidia_drm.fbdev=1"
@ -13,8 +13,8 @@
services.root-reset = { services.root-reset = {
description = "Reset root and snapshot last boot"; description = "Reset root and snapshot last boot";
wantedBy = [ "initrd.target" ]; wantedBy = [ "initrd.target" ];
after = [ "dev-${config.networking.hostName}-root.device" ];
before = [ "sysroot.mount" ]; before = [ "sysroot.mount" ];
after = [ "dev-${config.networking.hostName}-root.device" ];
unitConfig.DefaultDependencies = "no"; unitConfig.DefaultDependencies = "no";
serviceConfig.Type = "oneshot"; serviceConfig.Type = "oneshot";
script = '' script = ''

View file

@ -4,12 +4,12 @@
./boot ./boot
./disko ./disko
./hardware ./hardware
./wireguard
../../modules/system ../../modules/system
]; ];
system.lanzaboote.enable = true; system.lanzaboote.enable = true;
system.wireguard.client.enable = false;
system.video.nvidia.enable = true; system.video.nvidia.enable = true;
networking.hostName = "leash"; networking.hostName = "extern";
} }

View file

@ -6,11 +6,12 @@
disk = { disk = {
"${config.networking.hostName}" = { "${config.networking.hostName}" = {
type = "disk"; type = "disk";
device = "/dev/sdi"; device = "/dev/sdh";
content = { content = {
type = "gpt"; type = "gpt";
partitions = { partitions = {
ESP = { ESP = {
priority = 1;
size = "2G"; size = "2G";
type = "EF00"; type = "EF00";
content = { content = {

View file

@ -1,5 +1,7 @@
{ config, lib, modulesPath, ... }: { config, lib, modulesPath, ... }:
{ {
imports = [ (modulesPath + "/profiles/all-hardware.nix") ];
boot = { boot = {
initrd = { initrd = {
availableKernelModules = [ availableKernelModules = [
@ -7,15 +9,12 @@
"xhci_pci" "xhci_pci"
"ahci" "ahci"
"usbhid" "usbhid"
"uas"
"usb_storage" "usb_storage"
"sd_mod" "sd_mod"
]; ];
kernelModules = [ kernelModules = [
"dm-snapshot" "dm-snapshot"
"vfio"
"vfio_pci"
"vfio_iommu_type1"
"kvm-amd"
]; ];
}; };
}; };
@ -23,7 +22,7 @@
fileSystems = { fileSystems = {
# Remote # Remote
"/home/jimbo/JimboNFS" = { "/home/jimbo/JimboNFS" = {
device = "${config.ips.wgSpan}.1:/export/JimboNFS"; device = "10.100.0.1:/export/JimboNFS";
fsType = "nfs4"; fsType = "nfs4";
options = [ "x-systemd.automount" "_netdev" "nofail" "noauto" ]; options = [ "x-systemd.automount" "_netdev" "nofail" "noauto" ];
}; };

23
hosts/extern/wireguard/default.nix vendored Normal file
View file

@ -0,0 +1,23 @@
{ lib, config, ... }:
{
networking = {
firewall = {
allowedUDPPorts = [ 51820 ];
trustedInterfaces = [ "wgc" ];
};
wireguard.interfaces.wgc = {
ips = [ "10.100.0.20/24" ];
listenPort = 51820;
privateKey = config.secrets.wgClientPriv;
peers = [
{ # Cyberspark Server
publicKey = "qnOT/lXOJMaQgDUdXpyfGZB2IEyUouRje2m/bCe9ux8=";
allowedIPs = [ "10.100.0.0/24" ];
endpoint = "sv.${config.domains.jim1}:51820";
persistentKeepalive = 25;
}
];
};
};
}

View file

@ -21,5 +21,5 @@
../../../variables ../../../variables
]; ];
networking.hostName = "cyberspark"; 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,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" ];
}
];
};
};
}

View file

@ -1,8 +1,10 @@
{ config, lib, ... }: { lib, ... }:
{ {
imports = [ imports = [
./hardware
./boot ./boot
./disko
./hardware
./wireguard
# Apps and programs # Apps and programs
../../../modules/system ../../../modules/system
@ -30,5 +32,4 @@
}; };
networking.hostName = "lacros"; networking.hostName = "lacros";
networking.wireguard.interfaces."${config.ips.wgInt}".ips = [ "${config.ips.wgSpan}.18/24" ];
} }

View file

@ -0,0 +1,23 @@
{ lib, config, ... }:
{
networking = {
firewall = {
allowedUDPPorts = [ 51820 ];
trustedInterfaces = [ "wgc" ];
};
wireguard.interfaces.wgc = {
ips = [ "${config.ips.wgSpan}.18/24" ];
listenPort = 51820;
privateKey = config.secrets.wgClientPriv;
peers = [
{ # Cyberspark Server
publicKey = "qnOT/lXOJMaQgDUdXpyfGZB2IEyUouRje2m/bCe9ux8=";
allowedIPs = [ "10.100.0.0/24" ];
endpoint = "sv.${config.domains.jim1}:51820";
persistentKeepalive = 25;
}
];
};
};
}

View file

@ -1,9 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
../../../modules/home
../../../modules/home/programs/misc/remote-desktop
];
wayland.windowManager.sway.config.output.${config.displays.dI}.scale = "1.3";
}

View file

@ -1 +0,0 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK+L723mCLy9/9UAXwkY3+06Oq22dOj+lDnA0lMLbrsR

View file

@ -1,7 +0,0 @@
{ pkgs, ... }:
{
boot = {
kernelPackages = pkgs.linuxPackages_latest;
kernel.sysctl."vm.max_map_count" = 2147483642;
};
}

View file

@ -1,32 +0,0 @@
{ config, lib, hardware, ... }:
{
imports = [
./hardware
./boot
# Apps and programs
../../../modules/system
../../../modules/system/accounts
../../../modules/system/desktop
../../../modules/system/programs
../../../modules/system/services
# Devices and hardware
../../../modules/system/devices
../../../modules/system/devices/boot/extlinux
../../../modules/system/devices/networking/wireless
../../../modules/system/devices/networking/firewall/pc
../../../modules/system/devices/networking/wireguard/pc
# Extras
../../../overlays
../../../variables
# Imports
hardware.nixosModules.pine64-pinebook-pro
];
networking.hostName = "shuttle";
hardware.opengl.driSupport32Bit = lib.mkForce false;
networking.wireguard.interfaces."${config.ips.wgInt}".ips = [ "${config.ips.wgSpan}.17/24" ];
}

View file

@ -1,40 +0,0 @@
{ config, lib, pkgs, modulesPath, ... }:
{
boot = {
initrd = {
availableKernelModules = [ ];
kernelModules = [ ];
};
blacklistedKernelModules = [
"pcspkr"
];
};
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/25738e24-385e-4bcf-bff5-d0e6274003b6";
fsType = "btrfs";
};
"/boot" = {
device = "/dev/disk/by-uuid/01D2-E962";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
"/home/jimbo/Downloads" = {
device = "/dev/disk/by-uuid/f0b6cf4e-9576-4ab5-96ae-2a7e57599a35";
fsType = "btrfs";
};
"/home/jimbo/JimboNFS" = {
device = "${config.ips.wgSpan}.1:/export/JimboNFS";
fsType = "nfs4";
options = [ "x-systemd.automount" "_netdev" "nofail" "noauto" ];
};
};
swapDevices = [
{ device = "/dev/disk/by-uuid/95c43e5a-b53d-41fd-99a3-54181510070e"; }
];
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
}

View file

@ -30,8 +30,8 @@ in {
services.root-reset = { services.root-reset = {
description = "Reset root and snapshot last boot"; description = "Reset root and snapshot last boot";
wantedBy = [ "initrd.target" ]; wantedBy = [ "initrd.target" ];
after = [ "dev-${config.networking.hostName}-root.device" ];
before = [ "sysroot.mount" ]; before = [ "sysroot.mount" ];
after = [ "dev-${config.networking.hostName}-root.device" ];
unitConfig.DefaultDependencies = "no"; unitConfig.DefaultDependencies = "no";
serviceConfig.Type = "oneshot"; serviceConfig.Type = "oneshot";
script = '' script = ''

View file

@ -3,17 +3,17 @@
imports = [ imports = [
./boot ./boot
./disko ./disko
./firewall
./hardware ./hardware
../../modules/system ../../modules/system
]; ];
system.lanzaboote.enable = true; system.lanzaboote.enable = true;
system.wireless.enable = false; system.wireless.enable = false;
system.wireguard.client.enable = false;
system.video.nvidia.enable = true; system.video.nvidia.enable = true;
system.libvirtd.enable = true; system.libvirtd.enable = true;
environment.sessionVariables.NIXOS_OZONE_WL = "1"; environment.sessionVariables.NIXOS_OZONE_WL = "1";
networking.hostName = "firefly"; networking.hostName = "tower";
} }

View file

@ -11,6 +11,7 @@
type = "gpt"; type = "gpt";
partitions = { partitions = {
ESP = { ESP = {
priority = 1;
size = "2G"; size = "2G";
type = "EF00"; type = "EF00";
content = { content = {

View file

@ -0,0 +1,9 @@
{ ... }:
{
networking.firewall = {
allowedUDPPorts = [
27015 # Half-Life
7777 # Lethal Company
];
};
}

View file

@ -18,7 +18,6 @@
"${config.ws.w6}" "${config.ws.w6}"
"${config.ws.w4a}" "${config.ws.w4a}"
"${config.ws.w5a}" "${config.ws.w5a}"
"${config.ws.w6a}"
]; ];
workspaces3 = [ workspaces3 = [
"${config.ws.w7}" "${config.ws.w7}"
@ -26,6 +25,9 @@
"${config.ws.w9}" "${config.ws.w9}"
"${config.ws.w7a}" "${config.ws.w7a}"
"${config.ws.w8a}" "${config.ws.w8a}"
];
workspaces4 = [
"${config.ws.w6a}"
"${config.ws.w9a}" "${config.ws.w9a}"
]; ];
assign = output: workspaces: assign = output: workspaces:
@ -37,7 +39,8 @@
in in
(assign "${config.displays.d1}" workspaces1) ++ (assign "${config.displays.d1}" workspaces1) ++
(assign "${config.displays.d2}" workspaces2) ++ (assign "${config.displays.d2}" workspaces2) ++
(assign "${config.displays.d3}" workspaces3); (assign "${config.displays.d3}" workspaces3) ++
(assign "${config.displays.d4}" workspaces4);
# Rules # Rules
defaultWorkspace = config.ws.w1; defaultWorkspace = config.ws.w1;

View file

@ -6,16 +6,15 @@
hashedPassword = config.secrets.jimboAccPass; hashedPassword = config.secrets.jimboAccPass;
isNormalUser = true; isNormalUser = true;
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
(builtins.readFile ../../../../../hosts/firefly/id_ed25519.pub) (builtins.readFile ../../../../../hosts/tower/id_ed25519.pub)
(builtins.readFile ../../../../../hosts/detritus/id_ed25519.pub)
(builtins.readFile ../../../../../hosts/shuttle/id_ed25519.pub)
(builtins.readFile ../../../../../hosts/lacros/id_ed25519.pub) (builtins.readFile ../../../../../hosts/lacros/id_ed25519.pub)
(builtins.readFile ../../../../../hosts/redmond/id_ed25519.pub) (builtins.readFile ../../../../../hosts/redmond/id_ed25519.pub)
(builtins.readFile ../../../../../hosts/treefruit/id_ed25519.pub) (builtins.readFile ../../../../../hosts/pomme/id_ed25519.pub)
(builtins.readFile ../../../../../hosts/cyberspark/id_ed25519.pub) (builtins.readFile ../../../../../hosts/kitty/id_ed25519.pub)
(builtins.readFile ../../../../../hosts/bomberman/id_ed25519.pub) (builtins.readFile ../../../../../hosts/xenia/id_ed25519.pub)
(builtins.readFile ../../../../../hosts/prophet/id_ed25519.pub)
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJahAoF74BY6GCTsFkt1ADKaraFgJJozW1Y1aBTLK0j9 Pixel9" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJahAoF74BY6GCTsFkt1ADKaraFgJJozW1Y1aBTLK0j9 Pixel9"
]; ];

View file

@ -1,10 +1,6 @@
{ ... }: { ... }:
{ {
imports = [ imports = [ ./wireless ];
./firewall
./wireguard
./wireless
];
networking = { networking = {
wireless.enable = false; wireless.enable = false;

View file

@ -1,66 +0,0 @@
{ lib, config, ... }:
{
options.system.firewall = {
server = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable server firewall settings";
};
};
};
config = {
networking = {
firewall = {
allowPing = false;
extraInputRules = ''
${lib.optionalString (!config.system.firewall.server.enable) ''
ip saddr { ${config.ips.server}, 10.100.0.1 } accept comment "Accept Server"
''}
${lib.optionalString config.system.firewall.server.enable ''
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 = lib.mkIf config.system.firewall.server.enable {
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 { 58010, 57989, 57984 } dnat to ${config.ips.pc} comment "PC Sunshine TCP"
udp dport { 57998, 57999, 58000 } 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

@ -1,63 +0,0 @@
{ lib, config, ... }:
{
options.system.wireguard = {
client = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Enable WireGuard client";
};
};
server = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable WireGuard server";
};
};
};
config = {
networking = {
firewall.allowedUDPPorts = [ 51820 ];
nat = {
enable = config.system.wireguard.server.enable;
externalInterface = "${config.ips.netInt}";
internalInterfaces = [ "wgs" ];
};
wireguard.interfaces = {
wgc = lib.mkIf config.system.wireguard.client.enable {
# Define IP of client in per device config
listenPort = 51820;
privateKey = config.secrets.wgClientPriv;
peers = [
{ # NixOS Server
publicKey = "qnOT/lXOJMaQgDUdXpyfGZB2IEyUouRje2m/bCe9ux8=";
allowedIPs = [ "10.100.0.0/24" ];
endpoint = "sv.${config.domains.jim1}:51820";
persistentKeepalive = 25;
}
];
};
wgs = lib.mkIf config.system.wireguard.server.enable {
ips = [ "10.100.0.1/24" ];
listenPort = 51820;
privateKey = config.secrets.wgServerPriv;
peers = [
{ # NixOS
publicKey = "OKUH/h6YSURI4vgeTZKQD15QsqaygdbTn1mAWzQp9S0=";
allowedIPs = [ "10.100.0.16/28" ];
}
{ # Pixel 9
publicKey = "dPCtjm67adMZCnyL1O2L+uUOk0RbjA9T/tht1r+qcE4=";
allowedIPs = [ "10.100.0.2/32" ];
}
];
};
};
};
};
}

View file

@ -8,5 +8,6 @@
./mpd ./mpd
./ssh ./ssh
./sunshine ./sunshine
./tlp
]; ];
} }

View file

@ -16,17 +16,12 @@
right = "noop"; right = "noop";
}; };
control = { ctrlmod = {
backspace = "delete";
h = "left"; h = "left";
j = "down"; j = "down";
k = "up"; k = "up";
l = "right"; l = "right";
g = "macro(C-h)";
semicolon = "macro(C-l)";
};
ctrlmod = {
backspace = "delete";
"1" = "f1"; "1" = "f1";
"2" = "f2"; "2" = "f2";
"3" = "f3"; "3" = "f3";

View file

@ -3,5 +3,6 @@
services.sunshine = { services.sunshine = {
enable = config.system.desktop.enable; enable = config.system.desktop.enable;
autoStart = false; autoStart = false;
openFirewall = true;
}; };
} }

View file

@ -0,0 +1,4 @@
{ ... }:
{
services.tlp.enable = true;
}

View file

@ -6,11 +6,10 @@
}; };
config.ips = rec { config.ips = rec {
netInt = "eno1"; localSpan = "10.1.0";
localSpan = "10.0.0";
server = "${localSpan}.2"; server = "${localSpan}.2";
pc = "${localSpan}.3"; pc = "${localSpan}.4";
vm = "${localSpan}.4"; vm = "${localSpan}.5";
hx = "${localSpan}.70"; hx = "${localSpan}.70";
}; };
} }