Skip to content

Commit b7cfa40

Browse files
committed
style(hosts): format rvn-srv config
1 parent 70adee1 commit b7cfa40

File tree

2 files changed

+207
-223
lines changed

2 files changed

+207
-223
lines changed

modules/hosts/rvn-srv.nix

Lines changed: 139 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
1-
{ inputs
2-
, config
3-
, ...
4-
}:
1+
{ inputs, config, ... }:
52
let
63
hostMeta = {
74
name = "rvn-srv";
85
sshAlias = "srv";
96
tailscale = "100.125.172.110";
107
local = "192.168.1.46";
11-
sshPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJl/WCQsXEkE7em5A6d2Du2JAWngIPfA8sVuJP/9cuyq fbb@nixos";
12-
dnsServers = [
13-
"127.0.0.1"
14-
"192.168.1.202"
15-
"45.90.28.240"
16-
"45.90.30.240"
17-
];
8+
sshPublicKey =
9+
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJl/WCQsXEkE7em5A6d2Du2JAWngIPfA8sVuJP/9cuyq fbb@nixos";
10+
dnsServers = [ "127.0.0.1" "192.168.1.202" "45.90.28.240" "45.90.30.240" ];
1811
};
19-
in
20-
{
12+
in {
2113
# rvn-srv: Dendritic host configuration for MSI Cubi server
2214
# Hardware: Intel-based mini PC
2315
# Role: Home server running Plex, Home Assistant, and container services
@@ -26,41 +18,40 @@ in
2618
# Host metadata
2719
meta.hosts = [ hostMeta ];
2820

29-
modules.nixos."hosts/rvn-srv" =
30-
{ pkgs, lib, ... }:
31-
{
32-
imports = config.flake.lib.resolve [
33-
# Server preset (users, security, development, shell, system, vpn)
34-
"presets/server"
35-
36-
# system
37-
"secrets"
38-
"nas"
39-
"system/scheduled-suspend"
40-
"system/ananicy"
41-
42-
# services
43-
"services/home-assistant"
44-
"services/atticd"
45-
"services/attic-client"
46-
"services/komodo"
47-
"services/plex"
48-
"services/servarr"
49-
50-
# containerized services
51-
"virtualization/podman"
52-
"services/containers/redlib"
53-
"services/containers/termix"
54-
"services/containers/pihole"
55-
56-
# hardware configuration
57-
../../machines/msi-cubi/configuration.nix
58-
../../machines/msi-cubi/hardware-configuration.nix
59-
inputs.nixos-hardware.nixosModules.common-cpu-intel
60-
];
61-
62-
# Home Manager configuration for user
63-
home-manager.users.${config.flake.meta.user.username}.imports = config.flake.lib.resolveHm [
21+
modules.nixos."hosts/rvn-srv" = { pkgs, lib, ... }: {
22+
imports = config.flake.lib.resolve [
23+
# Server preset (users, security, development, shell, system, vpn)
24+
"presets/server"
25+
26+
# system
27+
"secrets"
28+
"nas"
29+
"system/scheduled-suspend"
30+
"system/ananicy"
31+
32+
# services
33+
"services/home-assistant"
34+
"services/atticd"
35+
"services/attic-client"
36+
"services/komodo"
37+
"services/plex"
38+
"services/servarr"
39+
40+
# containerized services
41+
"virtualization/podman"
42+
"services/containers/redlib"
43+
"services/containers/termix"
44+
"services/containers/pihole"
45+
46+
# hardware configuration
47+
../../machines/msi-cubi/configuration.nix
48+
../../machines/msi-cubi/hardware-configuration.nix
49+
inputs.nixos-hardware.nixosModules.common-cpu-intel
50+
];
51+
52+
# Home Manager configuration for user
53+
home-manager.users.${config.flake.meta.user.username}.imports =
54+
config.flake.lib.resolveHm [
6455
# Server preset modules for Home Manager
6556
"users"
6657
"dotfiles"
@@ -72,122 +63,125 @@ in
7263
"secrets"
7364
];
7465

75-
# Kernel tuning for server workload
76-
boot.kernel.sysctl = {
77-
"vm.swappiness" = 10; # Only swap when critically low on RAM
78-
"vm.vfs_cache_pressure" = 50; # Keep filesystem cache longer
79-
"vm.dirty_ratio" = 15; # Start sync at 15% RAM dirty
80-
"vm.dirty_background_ratio" = 10; # Background writes at 10%
81-
};
66+
# Kernel tuning for server workload
67+
boot.kernel.sysctl = {
68+
"vm.swappiness" = 10; # Only swap when critically low on RAM
69+
"vm.vfs_cache_pressure" = 50; # Keep filesystem cache longer
70+
"vm.dirty_ratio" = 15; # Start sync at 15% RAM dirty
71+
"vm.dirty_background_ratio" = 10; # Background writes at 10%
72+
};
8273

83-
# Scheduled suspend/wake for power savings
84-
powerManagement.scheduledSuspend = {
85-
enable = true;
86-
schedules = {
87-
weekday = {
88-
suspendTime = "00:30";
89-
wakeTime = "06:00";
90-
days = "Mon,Tue,Wed,Thu";
91-
};
92-
friday = {
93-
suspendTime = "02:00";
94-
wakeTime = "06:00";
95-
days = "Fri";
96-
};
97-
weekend = {
98-
suspendTime = "02:00";
99-
wakeTime = "08:00";
100-
days = "Sat,Sun";
101-
};
74+
# Scheduled suspend/wake for power savings
75+
powerManagement.scheduledSuspend = {
76+
enable = true;
77+
schedules = {
78+
weekday = {
79+
suspendTime = "00:30";
80+
wakeTime = "06:00";
81+
days = "Mon,Tue,Wed,Thu";
10282
};
103-
};
104-
105-
# Service-specific configuration
106-
services = {
107-
ananicy.enable = true;
108-
plex.nginx.port = 32402;
109-
pihole-container.listenAddress = hostMeta.local;
110-
pihole-container.webPort = 8082;
111-
112-
komodo = {
113-
core.host = "https://komodo.corvus-corax.synology.me";
114-
core.allowSignups = false;
115-
periphery.requirePasskey = false;
83+
friday = {
84+
suspendTime = "02:00";
85+
wakeTime = "06:00";
86+
days = "Fri";
11687
};
117-
118-
uptime-kuma = {
119-
enable = true;
120-
settings.HOST = "0.0.0.0";
88+
weekend = {
89+
suspendTime = "02:00";
90+
wakeTime = "08:00";
91+
days = "Sat,Sun";
12192
};
93+
};
94+
};
12295

123-
resolved = {
124-
enable = true;
125-
settings = {
126-
Resolve = {
127-
DNSStubListener = "no";
128-
};
129-
};
130-
};
131-
}
132-
// lib.optionalAttrs (config ? sops && config.sops ? templates) {
133-
pihole-container.webPasswordFile = config.sops.templates."pihole-webpassword".path;
96+
# Service-specific configuration
97+
services = {
98+
ananicy.enable = true;
99+
plex.nginx.port = 32402;
100+
pihole-container.listenAddress = hostMeta.local;
101+
pihole-container.webPort = 8082;
102+
103+
komodo = {
104+
core.host = "https://komodo.corvus-corax.synology.me";
105+
core.allowSignups = false;
106+
periphery.requirePasskey = false;
134107
};
135108

136-
# Networking configuration
137-
networking = {
138-
# Open port for uptime-kuma
139-
firewall.allowedTCPPorts = [ 3001 ];
109+
uptime-kuma = {
110+
enable = true;
111+
settings.HOST = "0.0.0.0";
112+
};
140113

141-
# Enable systemd-networkd for bonding support
142-
useNetworkd = true;
143-
useDHCP = false; # Disable legacy DHCP
144-
nameservers = hostMeta.dnsServers;
114+
glances = {
115+
enable = true;
116+
openFirewall = true;
117+
extraArgs =
118+
[ "-w" ]; # Enable web server mode for Home Assistant integration
145119
};
146120

147-
systemd.network.enable = true;
121+
resolved = {
122+
enable = true;
123+
settings = { Resolve = { DNSStubListener = "no"; }; };
124+
};
125+
} // lib.optionalAttrs (config ? sops && config.sops ? templates) {
126+
pihole-container.webPasswordFile =
127+
config.sops.templates."pihole-webpassword".path;
128+
};
148129

149-
# NIC bonding configuration for dual ethernet ports
150-
# Using balance-rr (no switch config needed)
151-
systemd.network = {
152-
netdevs."10-bond0" = {
153-
netdevConfig = {
154-
Kind = "bond";
155-
Name = "bond0";
156-
};
157-
bondConfig = {
158-
Mode = "balance-rr"; # Round-robin (no switch config needed)
159-
TransmitHashPolicy = "layer3+4"; # Hash by IP+port
160-
MIIMonitorSec = "100ms"; # Link monitoring
161-
};
130+
# Networking configuration
131+
networking = {
132+
# Open port for uptime-kuma
133+
firewall.allowedTCPPorts = [ 3001 ];
134+
135+
# Enable systemd-networkd for bonding support
136+
useNetworkd = true;
137+
useDHCP = false; # Disable legacy DHCP
138+
nameservers = hostMeta.dnsServers;
139+
};
140+
141+
systemd.network.enable = true;
142+
143+
# NIC bonding configuration for dual ethernet ports
144+
# Using balance-rr (no switch config needed)
145+
systemd.network = {
146+
netdevs."10-bond0" = {
147+
netdevConfig = {
148+
Kind = "bond";
149+
Name = "bond0";
162150
};
151+
bondConfig = {
152+
Mode = "balance-rr"; # Round-robin (no switch config needed)
153+
TransmitHashPolicy = "layer3+4"; # Hash by IP+port
154+
MIIMonitorSec = "100ms"; # Link monitoring
155+
};
156+
};
163157

164-
networks = {
165-
# Assign enp2s0 to bond
166-
"30-enp2s0" = {
167-
matchConfig.Name = "enp2s0";
168-
networkConfig.Bond = "bond0";
169-
};
158+
networks = {
159+
# Assign enp2s0 to bond
160+
"30-enp2s0" = {
161+
matchConfig.Name = "enp2s0";
162+
networkConfig.Bond = "bond0";
163+
};
170164

171-
# Assign enp3s0 to bond
172-
"30-enp3s0" = {
173-
matchConfig.Name = "enp3s0";
174-
networkConfig.Bond = "bond0";
175-
};
165+
# Assign enp3s0 to bond
166+
"30-enp3s0" = {
167+
matchConfig.Name = "enp3s0";
168+
networkConfig.Bond = "bond0";
169+
};
176170

177-
# Configure bond0 interface with static IP
178-
"40-bond0" = {
179-
matchConfig.Name = "bond0";
180-
linkConfig.RequiredForOnline = "carrier";
181-
networkConfig = {
182-
Address = "192.168.1.46/24";
183-
Gateway = "192.168.1.1";
184-
DNS = hostMeta.dnsServers;
185-
LinkLocalAddressing = "no";
186-
};
171+
# Configure bond0 interface with static IP
172+
"40-bond0" = {
173+
matchConfig.Name = "bond0";
174+
linkConfig.RequiredForOnline = "carrier";
175+
networkConfig = {
176+
Address = "192.168.1.46/24";
177+
Gateway = "192.168.1.1";
178+
DNS = hostMeta.dnsServers;
179+
LinkLocalAddressing = "no";
187180
};
188181
};
189182
};
190183
};
184+
};
191185

192186
};
193187
}

0 commit comments

Comments
 (0)