git.delta.rocks / jrsonnet / refs/commits / 8fb243b6f0b6

difftreelog

source

modules/hosts.nix2.1 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          hosts = mkOption {20            type = attrsOf (submodule {21              options.encryptionKey = mkOption {22                type = str;23                description = "Rage SSH encryption key for secrets.";24              };25            });26          };27        };28      };29      description = ''30        Configuration provided from outside.31        Usually used to persist fleet data between runs.32      '';33    };34    hosts = mkOption {35      type = mkHostsType ({config, ...}: {36        options = {37          system = mkOption {38            description = "Type of the system.";39            type = str;40            example = "x86_64-linux";41          };42          tags = mkOption {43            description = "Host tag. In CLI, you can refer to all hosts having this tag using @tag syntax.";44            type = listOf str;45          };46          network = mkOption {47            type = submodule {48              options = {49                internalIps = mkOption {50                  description = "Internal ips";51                  type = listOf str;52                  default = [];53                };54                externalIps = mkOption {55                  description = "External ips";56                  type = listOf str;57                  default = [];58                };59              };60            };61            description = "Network definition of host";62          };63        };64        config = {65          nixos.networking.hostName = mkFleetGeneratorDefault config._module.args.name;66          tags = ["all"];67        };68        _file = ./meta.nix;69      });70      default = {};71      description = "Configurations of individual hosts";72    };73  };74  _file = ./meta.nix;75}