|
1 | | -{ |
2 | | - config, |
3 | | - lib, |
4 | | - ... |
5 | | -}: { |
6 | | - options.mcl.host-info = with lib; { |
7 | | - type = mkOption { |
8 | | - type = types.nullOr (types.enum ["desktop" "server"]); |
9 | | - default = null; |
10 | | - example = ["desktop"]; |
11 | | - description = '' |
12 | | - Whether this host is a desktop or a server. |
13 | | - ''; |
14 | | - }; |
| 1 | +{withSystem, ...}: { |
| 2 | + flake.nixosModules.mcl-host-info = { |
| 3 | + config, |
| 4 | + lib, |
| 5 | + dirs, |
| 6 | + ... |
| 7 | + }: { |
| 8 | + options.mcl.host-info = with lib; { |
| 9 | + type = mkOption { |
| 10 | + type = types.nullOr (types.enum ["desktop" "server" "container"]); |
| 11 | + default = null; |
| 12 | + example = ["desktop"]; |
| 13 | + description = '' |
| 14 | + Whether this host is a desktop or a server. |
| 15 | + ''; |
| 16 | + }; |
15 | 17 |
|
16 | | - isVM = mkOption { |
17 | | - type = types.nullOr types.bool; |
18 | | - default = null; |
19 | | - example = ["false"]; |
20 | | - description = '' |
21 | | - Whether this configuration is a VM variant. |
22 | | - ''; |
23 | | - }; |
| 18 | + isDebugVM = mkOption { |
| 19 | + type = types.nullOr types.bool; |
| 20 | + default = null; |
| 21 | + example = ["false"]; |
| 22 | + description = '' |
| 23 | + Whether this configuration is a VM variant with extra debug |
| 24 | + functionality. |
| 25 | + ''; |
| 26 | + }; |
| 27 | + |
| 28 | + configPath = mkOption { |
| 29 | + type = types.nullOr types.path; |
| 30 | + default = null; |
| 31 | + example = ["machines/server/solunska-server"]; |
| 32 | + description = '' |
| 33 | + The configuration path for this host relative to the repo root. |
| 34 | + ''; |
| 35 | + }; |
24 | 36 |
|
25 | | - configPath = mkOption { |
26 | | - type = types.nullOr types.string; |
27 | | - default = null; |
28 | | - example = ["machines/server/solunska-server"]; |
29 | | - description = '' |
30 | | - The configuration path for this host relative to the repo root. |
31 | | - ''; |
| 37 | + sshKey = mkOption { |
| 38 | + type = types.nullOr types.str; |
| 39 | + default = null; |
| 40 | + example = "ssh-ed25519 AAAAC3Nza"; |
| 41 | + description = '' |
| 42 | + The public ssh key for this host. |
| 43 | + ''; |
| 44 | + }; |
| 45 | + }; |
| 46 | + config = { |
| 47 | + assertions = [ |
| 48 | + { |
| 49 | + assertion = config.mcl.host-info.type != null; |
| 50 | + message = "mcl.host-info.type must be defined for every host"; |
| 51 | + } |
| 52 | + { |
| 53 | + assertion = config.mcl.host-info.isDebugVM != null; |
| 54 | + message = "mcl.host-info.isDebugVM must be defined for every host"; |
| 55 | + } |
| 56 | + { |
| 57 | + assertion = config.mcl.host-info.configPath != null; |
| 58 | + message = "mcl.host-info.configPath must be defined for every host"; |
| 59 | + } |
| 60 | + { |
| 61 | + assertion = config.mcl.host-info.sshKey != null; |
| 62 | + message = "mcl.host-info.sshKey must be defined for every host"; |
| 63 | + } |
| 64 | + ]; |
32 | 65 | }; |
33 | | - }; |
34 | | - config = { |
35 | | - assertions = [ |
36 | | - { |
37 | | - assertion = config.mcl.host-info.type != null; |
38 | | - message = "mcl.host-info.type must be defined for every host"; |
39 | | - } |
40 | | - { |
41 | | - assertion = config.mcl.host-info.isVM != null; |
42 | | - message = "mcl.host-info.isVM must be defined for every host"; |
43 | | - } |
44 | | - { |
45 | | - assertion = config.mcl.host-info.configPath != null; |
46 | | - message = "mcl.host-info.configPath must be defined for every host"; |
47 | | - } |
48 | | - ]; |
49 | 66 | }; |
50 | 67 | } |
0 commit comments