git.delta.rocks / jrsonnet / refs/commits / 5b343db89280

difftreelog

source

modules/extras/tf.nix1.2 KiBsourcehistory
1{2  config,3  lib,4  fleetLib,5  inputs,6  ...7}:8let9  inherit (lib.options) mkOption;10  inherit (lib.types) deferredModule attrsOf unspecified;11  inherit (fleetLib.options) mkDataOption;12in13{1415  options = {16    tf = mkOption {17      type = deferredModule;18      apply =19        module: system:20        inputs.terranix.lib.terranixConfiguration {21          inherit system;22          pkgs = inputs.nixpkgs.legacyPackages.${system};23          modules = [24            module25          ];26        };27    };28  };2930  config = {31    flake.tf = config.tf;3233    tf.output.fleet = {34      value = {35        managed = true;36      };37      # Just to avoid printing this attribute on every apply, the whole fleet attribute38      # will be somehow processed by fleet tf.39      sensitive = true;40    };41    fleetConfigurations.default =42      { config, ... }:43      {44        options.data = mkDataOption {45          # host => hostData46          options.extra.terraformHosts = mkOption {47            default = { };48            type = attrsOf (attrsOf unspecified);49            description = "Hosts data provided by fleet tf";50          };51        };52        config.hosts = config.data.extra.terraformHosts;53      };5455    perSystem.imports = [ ./tf-bootstrap.nix ];56  };57}