Hello Norbert,
thanks for the answer.
To clarify it.
The aim is not to change the system state/configuration but to change/test the config (as kind of basline) with certain changes applied to.
You can’t change the configuration. Best you can get is to use evalModule or how it is called to get the eventual config returned such that you can inspect it, but you can’t write back to it or build a slightly altered version from the repl.
If you wanted to find out how to do it, you could start with nixos-rebuild – here you can see that it will try to build system attribute in the <nixpkgs/nixos> path:
Going through NIX_PATH, you will end up in nixos/default.nix file in Nixpkgs:
You can already see how it is put together, and if you want to evaluate the configuration with extra options, you can just pass them inside another module:
Also note that lists are concatenated by default so if you want to clear out services.xserver.displayManager.session, you would need to use lib.mkForce.