old
1{lib, ...}:
2with lib; let
3 secretType = types.submodule {
4 options = {
5 secretName = mkOption {
6 type = types.str;
7 };
8 };
9 };
10 optSecretType = types.nullOr (types.either types.str secretType);
11
12 hostModule = types.submodule {
13 options = {
14 network = mkOption {
15 type = networkModule;
16 default = {};
17 description = "Network configurations of the host.";
18 };
19 hostPublicKey = mkOption {
20 type = types.nullOr types.str;
21 default = null;
22 };
23 sshPorts = mkOption {
24 type = types.listOf types.port;
25 default = [22];
26 };
27 };
28 };
29
30 networkModule = types.submodule {
31 options = {
32 enable = mkOption {
33 type = types.nullOr (types.enum ["networkmanager" "networkd"]);
34 default = null;
35 description = "Which network manager to use.";
36 };
37 iface = mkOption {
38 type = types.str;
39 };
40 useDHCP = mkOption {
41 type = types.bool;
42 default = false;
43 };
44 nameservers = mkOption {
45 type = types.listOf types.str;
46 default = [];
47 };
48 search = mkOption {
49 type = types.listOf types.str;
50 default = [];
51 };
52 ipv4 = mkOption {
53 type = optSecretType;
54 default = null;
55 };
56 ipv6 = mkOption {
57 type = optSecretType;
58 default = null;
59 };
60 prefixLength4 = mkOption {
61 type = types.int;
62 default = 24;
63 };
64 prefixLength6 = mkOption {
65 type = types.int;
66 default = 64;
67 };
68 defaultGateway = mkOption {
69 type = optSecretType;
70 default = null;
71 };
72 defaultGateway6 = mkOption {
73 type = optSecretType;
74 default = null;
75 };
76 };
77 };
78in {
79 options.modules.my-hosts = mkOption {
80 type = types.attrsOf hostModule;
81 description = "My nix hosts general configuration";
82 default = {};
83 };
84 options.modules.currentHost = mkOption {
85 type = types.str;
86 };
87}