aboutsummaryrefslogtreecommitdiff
path: root/modules/services/nixos/networking/static.nix
blob: 9338a6ad0492e164bb45e81ad21b2ed0a0530395 (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
{
  lib,
  config,
  ...
}: let
  cfg = config.collinux.services.networking.static;
in
  lib.mkIf cfg.enable {
    networking = {
      wireless = {
        enable = true;
        networks.${cfg.ssid}.pskRaw = "ext:psk";
        secretsFile = config.age.secrets.${cfg.pskFile}.path;
      };

      # Disable default networking stuff
      dhcpcd.enable = false;
      useDHCP = false;
      networkmanager.enable = false;
    };

    systemd.network = {
      enable = true;
      networks."10-static-lan" = {
        name = "wl*";

        networkConfig = {
          Address = "${cfg.ip}/24";
          Gateway = cfg.gateway;
          DNS = "1.1.1.1";
          DHCP = "no";

          # diable ipv6 addresses
          IPv6AcceptRA = "no";
          IPv6PrivacyExtensions = "no";
          LinkLocalAddressing = "no";
        };
      };
    };
  }