main
1{lib, ...}: {
2 options.flake.meta = let
3 inherit (lib) mkOption types;
4
5 hostsOption = {
6 prefix = mkOption {
7 type = types.str;
8 default = "host/";
9 description = "Prefix for hosts";
10 };
11 hosts = mkOption {
12 type = types.attrsOf perHostOption;
13 default = {};
14 description = "Metas for each host";
15 };
16 };
17
18 perHostOption = types.submodule {
19 options = {
20 system = mkOption {
21 type = types.nonEmptyStr;
22 description = "System of the host.";
23 example = "x86_64-linux";
24 };
25 hostPubKey = mkOption {
26 type = types.str;
27 description = "Public host key of the host.";
28 };
29 sshPorts = mkOption {
30 type = types.listOf types.port;
31 default = [22];
32 description = "SSH ports of the host.";
33 };
34 deploy = lib.mkEnableOption {
35 default = false;
36 description = "Whether to deploy this host using deploy-rs.";
37 };
38
39 isServer = lib.mkEnableOption {
40 default = false;
41 description = "Whether this host is a server.";
42 };
43 isDesktop = lib.mkEnableOption {
44 default = false;
45 description = "Whether this host is a desktop.";
46 };
47 isLaptop = lib.mkEnableOption {
48 default = false;
49 description = "Whether this host is a laptop.";
50 };
51 };
52 };
53
54 servicesOption = {
55 prefix = mkOption {
56 type = types.str;
57 default = "service/";
58 description = "Prefix for services";
59 };
60 };
61 in
62 mkOption {
63 type = types.submodule {
64 freeformType = types.lazyAttrsOf types.anything;
65 options = {
66 host = hostsOption;
67 service = servicesOption;
68 };
69 };
70 };
71
72 config.flake.meta.uri = "github:HPCesia/nix-config";
73}