git.delta.rocks / jrsonnet / refs/commits / fcad02a8426f

difftreelog

source

modules/hosts.nix2.2 KiBsourcehistory
1{2  lib,3  fleetLib,4  ...5}: let6  inherit (fleetLib.modules) mkFleetGeneratorDefault;7  inherit (fleetLib.types) mkHostsType mkDataType;8  inherit (lib.options) mkOption;9  inherit (lib.types) str listOf attrsOf submodule;10in {11  options = {12    data = mkOption {13      type = mkDataType {14        options = {15          version = mkOption {16            type = str;17            internal = true;18          };19          gcRootPrefix = mkOption {20            type = str;21            internal = true;22          };23          hosts = mkOption {24            type = attrsOf (submodule {25              options.encryptionKey = mkOption {26                type = str;27                description = "Rage SSH encryption key for secrets.";28              };29            });30          };31        };32      };33      description = ''34        Configuration provided from outside.35        Usually used to persist fleet data between runs.36      '';37    };38    hosts = mkOption {39      type = mkHostsType ({config, ...}: {40        options = {41          system = mkOption {42            description = "Type of the system.";43            type = str;44            example = "x86_64-linux";45          };46          tags = mkOption {47            description = "Host tag. In CLI, you can refer to all hosts having this tag using @tag syntax.";48            type = listOf str;49          };50          network = mkOption {51            type = submodule {52              options = {53                internalIps = mkOption {54                  description = "Internal ips";55                  type = listOf str;56                  default = [];57                };58                externalIps = mkOption {59                  description = "External ips";60                  type = listOf str;61                  default = [];62                };63              };64            };65            description = "Network definition of host";66          };67        };68        config = {69          nixos.networking.hostName = mkFleetGeneratorDefault config._module.args.name;70          tags = ["all"];71        };72        _file = ./meta.nix;73      });74      default = {};75      description = "Configurations of individual hosts";76    };77  };78  _file = ./meta.nix;79}