aboutsummaryrefslogtreecommitdiff
path: root/modules/networking/options.nix
blob: cc4864b3db4284a8ae9be80f9915d35ff4a96935 (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
{
  lib,
  my-lib,
  ...
}: let
  inherit (my-lib.netTypes {inherit lib;}) ipAddr ipAddrCidr;
  inherit (lib) mkOption mkEnableOption;
in {
  options.collinux.system.network = {
    dns.areYouAServer = mkEnableOption "Set up unbound with the *.ganymede resolver and disable resolved stub";

    static = lib.mkOption {
      description = "Set a static IP address for this device on this network. Leave unset to use DHCP";
      type = lib.types.nullOr (lib.types.submodule {
        options = {
          ip = mkOption {
            description = "IP address";
            type = ipAddrCidr;
          };
          gateway = mkOption {
            description = "default gateway";
            type = ipAddr;
          };
        };
      });
      default = null;
    };

    wireless = {
      static = lib.mkOption {
        description = "Set a preconfigured SSID and PSK for the wireless config";
        type = lib.types.nullOr (lib.types.submodule {
          options = {
            ssid = mkOption {
              description = "SSID for this network";
              type = lib.types.str;
            };
            pskFile = mkOption {
              description = "Absolute path to a file containing the pre-shared key for this network in the form `psk:<wifi psk>`";
              type = lib.types.str;
              example = "/run/secrets.d/wifi-psk";
            };
          };
        });
        default = null;
      };
      dynamic = mkEnableOption "Enable dynamically joining wireless networks with iwd";
    };

    wireguard = {
      enable = mkEnableOption "Whether to enable Wireguard on this device";
      # peers = lib.types.listOf (lib.types.submodule {
      #   options = {
      #   };
      # });
    };
  };
}