I want to split my hosts in different files to separate host-specific config in different folders (like hosts/orca etc), how I proceed to do that with flakes?
You can add ./hosts/<hostname>/default.nix (or even ./hosts/<hostname> to the modules list in nixosSystem. That default.nix file will then work as the configuration.nix file does for non-flakes systems.
Can you give some more detail on what you’re trying to do? It’s possible to introspect your configuration with flakes just as it is with the configuration.nix style. If you want to automatically add systems based on their existence in ./hosts you’re probably going to want to use readDir. I do something similar to automatically add patches to my nixpkgs here: nixos-config/flake.nix at 1bcc033dbcd4f24cf51faf1d8bdc4bf9632ff87e · chvp/nixos-config · GitHub
I’ll second needing to use readDir. In my configs, I have my hosts organized by platform and hostname. I then use readDir to enumerate both and add them to my flake. I can add a new host just by creating an appropriate directory and putting configuration.nix in it. It’s a bit messy (could use refactoring), but it works.
@chvp@reckenrode I’m still not comfortable with nix and neither is it a simple language to comprehend but I kind of understand the way you have created the functions and pass params to them. I’ll try to do something similar. Thanks for the help.