I've started using NixOS. As far as I understand Nix is a purpose built functional language to avoid side-effects. All packages are part of a giant attribute set but as everything is lazily evaluated there is no problem. By accessing one member you basically "make something happen", but even then a "derivation" is just a value and you also need to explicitly "build" it too.
I wonder how environment.systemPackages is exactly implemented then and where I can find the source of it? (I've tried searching through nixpkgs but there were too many false positive hits.).
I just want to understand the whole process and possibly even hack up a config file so that a local user could have a declaratively managed list of packages installed (similar to systemPackages for all) versus using an imperative way of (automatically) running
nix-env -i. I've seen
~/.config/nixpkgs/config.nix examples and am able to implement the packageOverrides function. But this way I would be just able to create some sort of new meta-package "including" others ones (still nothing would get automatically installed) or am I mistaken? I've heared about a thing called overlays - how does this concept fit into the picture?