For me, all the websites and articles only talked about the advantages and wanted to sell nix to me. But I was already sold, I just didn't know how exactly it works.
Now, after many articles, I finally read the nix-pill about derivations. I realized, it's actually very simple: All the nix code evaluates to data structures called derivations. A derivation is a json-like data structure which has a few fields that describe how to build a package in the nix-store. Basically build time dependencies, runtime dependencies and a command to produce artifacts.