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

difftreelog

source

modules/fleet/meta.nix2.1 KiBsourcehistory
1{2  lib,3  fleetLib,4  config,5  nixpkgs,6  ...7}:8with lib; let9  hostModule = with types;10    {...} @ hostConfig: {11      options = {12        modules = mkOption {13          type = listOf (mkOptionType {14            name = "submodule";15            inherit (submodule {}) check;16            merge = lib.options.mergeOneOption;17            description = "Nixos modules";18          });19          description = "List of nixos modules";20          default = [];21        };22        system = mkOption {23          type = str;24          description = "Type of system";25        };26        encryptionKey = mkOption {27          type = str;28          description = "Encryption key";29        };30        nixosSystem = mkOption {31          type = unspecified;32          description = "Nixos configuration";33        };34      };35      config.nixosSystem = nixpkgs.lib.nixosSystem {36        inherit (hostConfig.config) system modules;37        specialArgs = {38          inherit fleetLib;39          fleet = fleetLib.hostsToAttrs (host: config.hosts.${host}.nixosSystem.config);40        };41      };42    };43  overlayType = mkOptionType {44    name = "nixpkgs-overlay";45    description = "nixpkgs overlay";46    check = lib.isFunction;47    merge = lib.mergeOneOption;48  };49in {50  options = with types; {51    hosts = mkOption {52      type = attrsOf (submodule hostModule);53      default = {};54      description = "Configurations of individual hosts";55    };56    globalModules = mkOption {57      type = listOf (mkOptionType {58        name = "submodule";59        inherit (submodule {}) check;60        merge = lib.options.mergeOneOption;61        description = "Nixos modules";62      });63      description = "Modules, which should be added to every system";64      default = [];65    };66    overlays = mkOption {67      default = [];68      type = listOf overlayType;69    };70  };71  config = {72    hosts = fleetLib.hostsToAttrs (host: {73      modules =74        config.globalModules75        ++ [76          ({...}: {77            nixpkgs.overlays = config.overlays;78          })79        ];80    });81    globalModules = import ../../nixos/modules/module-list.nix;82  };83}