It's complex, because it does a lot of things, and it evolved over the past few years. The basics are very, very simple:
#+begin_src nix :tangle out/flake.nix :noweb no-export :noweb-prefix no :mkdirp t
{
inputs = {
<<flake-inputs>>
};
outputs = { self, nixpkgs, ... }@inputs: {
<<flake-outputs>>
};
}
#+end_src
In some other file, you can then do:
#+begin_src nix :noweb-ref flake-inputs
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
#+end_src
And voila, you now have:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
};
// ...rest of the flake
}
How you organize your org documents, is entirely up to you. The trick is that this lets you split it up as you see fit, and you are no longer restricted by what the language or any framework built on top of it can provide.