From a NixOS module, is it possible to delete an entry from an attrset defined by a different module?

Perhaps the best solution to the original problem would be to modify postfix to accept local = null; or add a boolean flag to suppress parts of the configuration, whatever makes sense, is easier to explain in the documentation and harder to misuse accidentally. Adding complexity is not always the best approach. Modules are supposed to be merged together, perhaps with conflict resolution. Any behavior beyond merging would be surprising and hard to debug.

Let’s keep NixOS simple - there are already jokes that NixOS requires PhD in computer science GitHub - ashos/ashos: The immutable/mutable meta-distribution (universal bootstrapper)

2 Likes

Some prior art that I always mildly enjoy when I reach for it is lib.kernel.unset - a “value that isn’t a value” thing behaving like undefined is a helpful concept in this sort of situation.

The closest thing Nix has is null - though the semantics aren’t part of the module system and are only for attrset keys: note { foo = null; } and { ${null} = null; } as examples.