aboutsummaryrefslogtreecommitdiff
path: root/hosts/nyaan/network.nix
blob: ea4f9a5298ea4dba23e4b0100e633ed99766c1e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{ config, flakeRoot, ... }:
let
  secrets = config.sops.secrets;
in
{
  imports = [ (flakeRoot + /wireguard.nix) ];

  sops = {
    age.keyFile = "/var/lib/sops-nix/key.txt";
    secrets."wireless.env" = {
      sopsFile = ../../secrets/wireless.env;
      owner = "wpa_supplicant";
      group = "wpa_supplicant";
      format = "dotenv";
    };
  };

  networking = {
    hostName = "nyaan";
    useNetworkd = true;
    wireless = {
      enable = true;
      secretsFile = secrets."wireless.env".path;
      userControlled = true;
      networks = {
        "KopsiNet-5".pskRaw = "ext:kopsinet_psk";
        "Pixel_3139" = {
          pskRaw = "ext:phone_hotspot_psk";
          hidden = true;
        };
        "eduroam" = {
          authProtocols = [ "WPA-EAP" ];
          auth = ''
            pairwise=CCMP TKIP
            eap=TTLS PEAP TLS
            group=CCMP TKIP
            identity="mbastaja@tvz.hr"
            altsubject_match="DNS:freeradius.tvz.hr"
            phase1="peaplabel=0"
            phase2="auth=PAP"
            password="ext:eduroam_pass"
            anonymous_identity="anonymous@tvz.hr"
          '';
        };
        "Students-TVZ" = {
          authProtocols = [ "WPA-EAP" ];
          auth = ''
            pairwise=CCMP TKIP
            eap=PEAP
            group=CCMP TKIP
            identity="mbastaja@tvz.hr"
            phase1="peaplabel=0"
            phase2="auth=MSCHAPV2"
            password="ext:eduroam_pass"
          '';
        };
      };
    };
    extraHosts = ''
      192.168.23.1 sagittarius sagittarius.local
      2301:db8:acad:a::1 sagittarius sagittarius.local
    '';
  };
}