6 ...6 ...
7}:7}:
8with lib; let8with lib;
9with fleetLib; let
9 hostModule = with types;10 hostModule = with types;
10 {...} @ hostConfig: {11 {...} @ hostConfig: let
12 hostName = hostConfig.config._module.args.name;
13 in {
11 options = {14 options = {
12 modules = mkOption {15 modules = mkOption {
13 type = listOf (mkOptionType {16 type = listOf (mkOptionType {
32 description = "Nixos configuration";35 description = "Nixos configuration";
33 };36 };
34 };37 };
35 config.nixosSystem = nixpkgs.lib.nixosSystem {38 config = {
39 nixosSystem = nixpkgs.lib.nixosSystem {
36 inherit (hostConfig.config) system modules;40 inherit (hostConfig.config) system modules;
37 specialArgs = {41 specialArgs = {
38 inherit fleetLib;42 inherit fleetLib;
39 fleet = fleetLib.hostsToAttrs (host: config.hosts.${host}.nixosSystem.config);43 fleet = hostsToAttrs (host: config.hosts.${host}.nixosSystem.config);
40 };44 };
41 };45 };
46 modules = [
47 ({...}: {
48 networking.hostName = mkFleetDefault hostName;
49 })
50 ];
51 };
42 };52 };
43 overlayType = mkOptionType {53 overlayType = mkOptionType {
44 name = "nixpkgs-overlay";54 name = "nixpkgs-overlay";
69 };79 };
70 };80 };
71 config = {81 config = {
72 hosts = fleetLib.hostsToAttrs (host: {82 hosts = hostsToAttrs (host: {
73 modules =83 modules =
74 config.globalModules84 config.globalModules
75 ++ [85 ++ [