some ai generated work to get services working for macos
This commit is contained in:
@@ -145,10 +145,23 @@ in
|
||||
internal = true;
|
||||
type = types.raw;
|
||||
default = lib.mapAttrs (machineName: _: {
|
||||
# This is the list of nixosModules for each machine
|
||||
# This is the list of service modules for each machine (nixos or darwin)
|
||||
machineImports = lib.foldlAttrs (
|
||||
acc: _module_ident: serviceModule:
|
||||
acc ++ [ serviceModule.result.final.${machineName}.nixosModule or { } ]
|
||||
let
|
||||
modName =
|
||||
if inventory.machines.${machineName}.machineClass == "darwin" then
|
||||
"darwinModule"
|
||||
else
|
||||
"nixosModule";
|
||||
finalForMachine = serviceModule.result.final.${machineName} or { };
|
||||
picked =
|
||||
if builtins.hasAttr modName finalForMachine then
|
||||
(builtins.getAttr modName finalForMachine)
|
||||
else
|
||||
{ };
|
||||
in
|
||||
acc ++ [ picked ]
|
||||
) [ ] config._services.mappedServices;
|
||||
}) inventory.machines or { };
|
||||
};
|
||||
|
||||
@@ -192,7 +192,7 @@ in
|
||||
# - darwinModules (_class = darwin)
|
||||
(lib.optionalAttrs (clan-core ? "${_class}Modules") clan-core."${_class}Modules".clanCore)
|
||||
]
|
||||
++ lib.optionals (_class == "nixos") (v.machineImports or [ ]);
|
||||
++ (v.machineImports or [ ]);
|
||||
|
||||
# default hostname
|
||||
networking.hostName = lib.mkDefault name;
|
||||
|
||||
Reference in New Issue
Block a user