From 2b2338a0daccf21410bc5e19d9e55089910b020f Mon Sep 17 00:00:00 2001 From: bogale Date: Sun, 8 Nov 2026 21:06:08 +0900 Subject: [PATCH] moved ap to module --- desktop/configuration.nix | 7 ------- desktop/mods/pxeboot.nix | 2 ++ mods/host.nix | 8 -------- server/configuration.nix | 28 ++----------------------- server/mods/ap.nix | 43 +++++++++++++++++++++++++++++++++++++++ server/mods/system.nix | 11 ---------- 6 files changed, 47 insertions(+), 52 deletions(-) create mode 100644 server/mods/ap.nix diff --git a/desktop/configuration.nix b/desktop/configuration.nix index 3b93b0d..aa5f649 100644 --- a/desktop/configuration.nix +++ b/desktop/configuration.nix @@ -48,13 +48,6 @@ passwordlessSyncUsers = [ "bogale" ]; settings.cursor.size = 24; }; - greetd = { - enable = true; - settings.default_session = { - command = "${pkgs.noctalia-greeter}/bin/noctalia-greeter-session"; - user = "greeter"; - }; - }; logind.settings.Login.HandleLidSwitch = "suspend-then-hibernate"; pipewire = { enable = true; diff --git a/desktop/mods/pxeboot.nix b/desktop/mods/pxeboot.nix index ad99282..317f751 100644 --- a/desktop/mods/pxeboot.nix +++ b/desktop/mods/pxeboot.nix @@ -4,10 +4,12 @@ allowedTCPPorts = [ 2049 ]; allowedUDPPorts = [ 547 + 67 69 ]; }; nat = { + enable = true; enableIPv6 = true; internalInterfaces = [ "br0" ]; }; diff --git a/mods/host.nix b/mods/host.nix index a5ed3fc..65a36d4 100644 --- a/mods/host.nix +++ b/mods/host.nix @@ -16,14 +16,6 @@ ./vps-init.nix ]; networking = { - firewall = { - allowedTCPPorts = [ 53 ]; - allowedUDPPorts = [ - 53 - 67 - ]; - }; - nat.enable = true; networkmanager.ensureProfiles = { environmentFiles = [ config.sops.secrets.wifi-env.path ]; profiles = { diff --git a/server/configuration.nix b/server/configuration.nix index 6aa2723..455b061 100644 --- a/server/configuration.nix +++ b/server/configuration.nix @@ -1,8 +1,5 @@ -{ config, pkgs, ... }: { - boot.kernelParams = [ - "cfg80211.ieee80211_regdom=RU" - "consoleblank=60" - ]; +{ config, ... }: { + boot.kernelParams = [ "consoleblank=60" ]; imports = [ ../mods/host.nix ./hardware.nix @@ -22,27 +19,6 @@ allowedUDPPorts = [ 443 ]; }; hostName = "nixos-server"; - nat.internalInterfaces = [ "wlp2s0" ]; - networkmanager.ensureProfiles.profiles = { - dhcp-ethernet.ethernet.cloned-mac-address = "0C:0E:76:A6:E6:B6"; - home-wifi = { - ipv4 = { - addresses = "10.1.0.1/16"; - method = "shared"; - }; - wifi = { - band = "a"; - channel = 157; - channel-width = 80; - mode = "ap"; - }; - wifi-security = { - group = "ccmp"; - pairwise = "ccmp"; - proto = "rsn"; - }; - }; - }; wg-quick.interfaces.awg0.configFile = config.sops.templates.awg1-conf.path; }; security.acme = { diff --git a/server/mods/ap.nix b/server/mods/ap.nix new file mode 100644 index 0000000..e98544c --- /dev/null +++ b/server/mods/ap.nix @@ -0,0 +1,43 @@ +{ + boot.kernelParams = [ "cfg80211.ieee80211_regdom=RU" ]; + networking = { + firewall = { + allowedTCPPorts = [ 53 ]; + allowedUDPPorts = [ + 53 + 67 + ]; + }; + networkmanager.ensureProfiles.profiles = { + dhcp-ethernet.ethernet.cloned-mac-address = "0C:0E:76:A6:E6:B6"; + home-wifi = { + ipv4 = { + addresses = "10.1.0.1/16"; + method = "shared"; + }; + wifi = { + band = "a"; + channel = 157; + channel-width = 80; + mode = "ap"; + }; + wifi-security = { + group = "ccmp"; + pairwise = "ccmp"; + proto = "rsn"; + }; + }; + }; + }; + systemd.services.hotspot-routing = { + after = [ "wg-quick-awg0.service" ]; + path = [ pkgs.iproute2 ]; + preStop = "ip rule del from 10.1.0.0/16 lookup main"; + requiredBy = [ "wg-quick-awg0.service" ]; + script = "ip rule add from 10.1.0.0/16 lookup main"; + serviceConfig = { + RemainAfterExit = true; + Type = "oneshot"; + }; + }; +} diff --git a/server/mods/system.nix b/server/mods/system.nix index 53ca29e..c9889ee 100644 --- a/server/mods/system.nix +++ b/server/mods/system.nix @@ -18,17 +18,6 @@ sops.secrets.tgbot-env = { }; systemd = { services = { - hotspot-routing = { - after = [ "wg-quick-awg0.service" ]; - path = [ pkgs.iproute2 ]; - preStop = "ip rule del from 10.1.0.0/16 lookup main"; - requiredBy = [ "wg-quick-awg0.service" ]; - script = "ip rule add from 10.1.0.0/16 lookup main"; - serviceConfig = { - RemainAfterExit = true; - Type = "oneshot"; - }; - }; network-watchdog = { path = with pkgs; [ curl