(Before you ask about that leading slash: that’s the key, taken verbatim from modules/services/x11/xserver.nix).
I see the “ook!” when I run nix-rebuild switch (multiple times, in fact – that’s also curious), so the overlay does get applied. But the pesky /etc entry is still there!
Adding new /etc entries in the same overlay does not work either, so it appears rather that some magic prevents me from screwing with /etc using overlays.
Or, I guess more likely, I’m missing something blindingly obvious? Halp!
You’re conflating nixpkgs, which is the expression that yields an attrset of all packages that nix knows how to build, with a NixOS configuration, which is a nix expression that instructs the nixos-* commands on how to build a NixOS system.
Nixpkgs is not NixOS, even though the two are tightly integrated. For example, you can use nixpkgs as a general packaging solution or to build operating systems that are not NixOS but use Nix packages (like I am doing with my project https://intrustd.com – see https://github.com/intrustd/ for the Nix expressions).
What’s going on here is you’re attempting to add a NixOS module configuration as an overlay to nixpkgs. This doesn’t work because nixpkgs – again, just a dumb set of packages – doesn’t care what’s in etc.
To fix your problem, you need to look at the environment.etc.* options in NixOS, which you can do here.
There’s a convenient enable flag on each environment.etc.* module. So, if you want to remove the 10-evdev.conf file, you can add the following line to configuration.nix directly.
Thanks, this is quite helpful (and of course my actual problem was elsewhere, but that’s beside the point…).
So, just to see if I understand correctly: NixOS module evaluation is sequenced “after” nixpkgs evaluation (I understand that this is fuzzy due to laziness); the way modules are evaluated does not have any provisions for overlaying or the like, and attributes like environment are computed only by modules?
NixOS module evaluation is sequenced “after” nixpkgs evaluation (I understand that this is fuzzy due to laziness)
Yes that’s correct, in terms of the order that code is evaluated in.
the way modules are evaluated does not have any provisions for overlaying or the like, and attributes like environment are computed only by modules?
All of the options described in man configuration.nix or the NixOS manual are only at the module level, and are “above” / outside of Nixpkgs, yes. Modules don’t have the same overlay mechanism that Nixpkgs does, but it’s still possible to override any settings you like. All option definitions (assignments) have priorities and these can be used to override values set elsewhere, with e.g. lib.mkForce or lib.mkOverride. The manual has a brief section on this here. Removing values is trickier, but in this case @tathougies’s solution works.