From 5a367139ad660808366a941de1e42a72c1606ce6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Fri, 5 Apr 2024 09:40:38 +0200 Subject: Multiple improvements --- nixos/modules/default.nix | 22 ++++++++++++++-------- nixos/modules/wifi-spt.nix | 12 +++++++++--- nixos/modules/wireguad.nix | 2 ++ 3 files changed, 25 insertions(+), 11 deletions(-) (limited to 'nixos/modules') diff --git a/nixos/modules/default.nix b/nixos/modules/default.nix index ea2acb3..c47228b 100644 --- a/nixos/modules/default.nix +++ b/nixos/modules/default.nix @@ -1,10 +1,16 @@ -{lib}: let +{ + lib, + default_modules ? [], +}: let inherit (builtins) readDir; - inherit (lib) filterAttrs hasSuffix mapAttrs' nameValuePair removeSuffix; + inherit (lib) filterAttrs hasSuffix attrValues mapAttrs' nameValuePair removeSuffix; + + modules = + mapAttrs' + (fname: _: nameValuePair (removeSuffix ".nix" fname) (./. + ("/" + fname))) + (filterAttrs ( + n: v: + v == "regular" && n != "default.nix" && hasSuffix ".nix" n + ) (readDir ./.)); in - mapAttrs' - (fname: _: nameValuePair (removeSuffix ".nix" fname) (./. + ("/" + fname))) - (filterAttrs ( - n: v: - v == "regular" && n != "default.nix" && hasSuffix ".nix" n - ) (readDir ./.)) + modules // {default.imports = attrValues modules ++ default_modules;} diff --git a/nixos/modules/wifi-spt.nix b/nixos/modules/wifi-spt.nix index 11554a7..669439d 100644 --- a/nixos/modules/wifi-spt.nix +++ b/nixos/modules/wifi-spt.nix @@ -102,7 +102,7 @@ in { mode = "wpa2-sha256"; wpaPasswordFile = "/run/secrets/hostapd-TurrisRules.pass"; }; - settings = { + settings = mkIf is2g { ieee80211w = 0; wpa_key_mgmt = mkForce "WPA-PSK"; # force use without sha256 }; @@ -123,7 +123,10 @@ in { systemd.network.networks = mkMerge [ (mkIf (cnf.ar9287.interface != null) { "lan-${cnf.ar9287.interface}" = { - matchConfig.Name = cnf.ar9287.interface; + matchConfig = { + Name = cnf.ar9287.interface; + WLANInterfaceType = "ap"; + }; networkConfig.Bridge = "brlan"; bridgeVLANs = [ { @@ -149,7 +152,10 @@ in { }) (mkIf (cnf.qca988x.interface != null) { "lan-${cnf.qca988x.interface}" = { - matchConfig.Name = cnf.qca988x.interface; + matchConfig = { + Name = cnf.qca988x.interface; + WLANInterfaceType = "ap"; + }; networkConfig.Bridge = "brlan"; bridgeVLANs = [ { diff --git a/nixos/modules/wireguad.nix b/nixos/modules/wireguad.nix index ca28818..f52c95e 100644 --- a/nixos/modules/wireguad.nix +++ b/nixos/modules/wireguad.nix @@ -79,6 +79,8 @@ in { networkConfig = { Address = "${config.cynerd.hosts.wg."${hostName}"}/24"; IPForward = is_endpoint; + DNS = mkIf (hostName != "dean") ["10.0.20.30" "10.0.20.31"]; + Domains = mkIf (hostName != "dean") "~elektroline.cz"; }; routes = (optional (hostName != "lipwig") { -- cgit v1.2.3