diff options
author | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2019-09-08 10:36:06 -0400 |
---|---|---|
committer | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2019-09-08 10:36:31 -0400 |
commit | 51cd84845b1031be32d594da45578c7c3ee09b48 (patch) | |
tree | 487ef979eb33add5bfbdbf642711dd377d118b59 /config | |
parent | 5b26cad95fa9233d510bb58b56f957e486055982 (diff) |
add ap config
Diffstat (limited to 'config')
-rw-r--r-- | config/ap.nix | 67 | ||||
-rw-r--r-- | config/desktop.nix | 6 |
2 files changed, 70 insertions, 3 deletions
diff --git a/config/ap.nix b/config/ap.nix new file mode 100644 index 0000000..9721e9b --- /dev/null +++ b/config/ap.nix @@ -0,0 +1,67 @@ +{ config, lib, pkgs, ... }: +{ + networking.networkmanager.enable = lib.mkForce false; + + networking.firewall = { + enable = lib.mkForce true; + allowedTCPPorts = [ 53 22 ]; + allowedUDPPorts = [ 53 67 68 ]; + allowPing = true; + logRefusedConnections = false; + checkReversePath = false; + trustedInterfaces = [ "wlp3s0" ]; + }; + + services = { + openssh.enable = lib.mkDefault true; + openssh.passwordAuthentication = false; + }; + + services.hostapd = { + enable = true; + ssid = "donkey kong"; + wpaPassphrase = "bananaicecream"; + interface = "wlp3s0"; + hwMode = "g"; + channel = 1; + extraConfig = '' + country_code=US + wpa_key_mgmt=WPA-PSK + rsn_pairwise=CCMP + ''; + }; + + services.dnsmasq = { + enable = true; + servers = [ "8.8.8.8" "8.8.4.4" ]; + extraConfig = '' + dhcp-range=10.64.30.100,10.64.30.255,255.255.255.0,24h + dhcp-option=option:router,10.64.30.1 + dhcp-option=option:dns-server,10.64.30.1 + dhcp-option=option:netmask,255.255.255.0 + ''; + }; + + networking.nat = { + enable = true; + externalInterface = "enp0s25"; + internalInterfaces = [ "wlp3s0" ]; + # internalIPs = [ "10.0.0.0/24" ]; + }; + + networking.interfaces.enp0s25 = { + useDHCP = true; + }; + + networking.interfaces.wlp3s0 = { + ipv4.addresses = [ { + address = "10.64.30.1"; + prefixLength = 24; + } ]; + }; + + system.requiredKernelConfig = + with config.lib.kernelConfig; [ + (isEnabled "CONFIG_DRIVER_NL80211") + ]; +} diff --git a/config/desktop.nix b/config/desktop.nix index 28115ca..552897e 100644 --- a/config/desktop.nix +++ b/config/desktop.nix @@ -28,8 +28,8 @@ }; networking = { - networkmanager.enable = true; - firewall.enable = true; + networkmanager.enable = lib.mkDefault true; + firewall.enable = lib.mkDefault true; }; fonts = { @@ -39,7 +39,7 @@ environment.systemPackages = with pkgs; [ chromium - dmenu2 + dmenu emacs25 firefox haskellPackages.xmobar |