Context
I was refactoring a NixOS configuration of a machine with better designed NixOS modules. It was not supposed to change anything in the final configuration, or so I thought.
After the refactoring, while deploying a machine with NixOps, I noticed that some derivations were build and deployed. Since I thought my refactoring did not change the configuration of the machine, I was surprised to see anything being build.
After investigation, I noticed that my refactoring changed the order of the elements listed in environment.systemPackages
.
Question
How relevant is the order of elements in environment.systemPackages
for the final configuration of the machine?
I might be unaware of some internal implementation details, but the only potential impact that you’ll have in practice is; if there’s different package providing the same files, the order with which they were specified can influence from which package those files are linked.
For example, if you add both nodejs_18 and nodejs_20, only one can be executed when you run node
in your terminal. I believe it’s the first one, at least that’s the result I get when creating a shell environment. I tried building a NixOS VM image to be certain, but didn’t manage to.
Anyway, as long as you don’t have that, it probably won’t make a difference, though it’s hard to check. I tried it out with a dev shell, and the generated file does actually change, so even with nix hash path
, you see that the output is technically different, even though the observable result stays the same.
1 Like