Careful not to veer too far into premature optimization which is the root of all evil. Getting too creative with the code sometimes results in a spike of wtfs/minute when the code breaks. That being said, it’s your computer and your code. Hack away.
I assume by “importing a flake” you mean getting your code depend on a different flake:
Using inputs
(the way you’re doing it) is how it should be done. While there are other mechanisms (getFlake
, for example) they aren’t for standard usage. Typically they break the purity and come with gotchas.
If by “importing a flake” you mean “importing a module from a different flake”, you could leverage specialArgs
argument for nixosSystem
(see this thread for details and links).
Offtopic but I’d be happy to get feedback on which parts could be explained better. Feel free to send a DM or an email.
If I recall correctly, nix-the-language clicked for me when I understood that it’s execution model is one that computes a fix point – i.e. it tries to merge attribute sets, evaluate and resolve attributes until the value finally becomes constant and cannot be evaluated further (usually the good result) or it enters infinite recursion (and spews errors).