letThemPlay , 1 month ago I do have a function that I cribbed from somewhere, unfortunately I didn't note down the source at the time so can't give them due credit here. filterNixFiles = k: v: v == "regular" && lib.hasSuffix ".nix" k; importNixFiles = path: (lib.lists.forEach (lib.mapAttrsToList (name: _: path + ("/" + name)) (lib.filterAttrs filterNixFiles (builtins.readDir path)))) import; Then used as normal modules = [ home-manager.nixosModules.home-manager vscode-server.nixosModule ] ++ (importNixFiles ./hosts/required) ++ (importNixFiles ./hosts/machines/${hostname}) Edit Apologies for formatting on mobile
I do have a function that I cribbed from somewhere, unfortunately I didn't note down the source at the time so can't give them due credit here.
filterNixFiles = k: v: v == "regular" && lib.hasSuffix ".nix" k;
importNixFiles = path: (lib.lists.forEach (lib.mapAttrsToList (name: _: path + ("/" + name)) (lib.filterAttrs filterNixFiles (builtins.readDir path)))) import;
Then used as normal
modules = [ home-manager.nixosModules.home-manager vscode-server.nixosModule ] ++ (importNixFiles ./hosts/required) ++ (importNixFiles ./hosts/machines/${hostname})
Edit
Apologies for formatting on mobile