The files serve different purposes, which remain complementary:
environment.d
defines variables for systemd user services;
.bashrc
, if it defines variables, defines them for any interactive, non-login instance of Bash;
.profile
, if it defines variables, defines them for any interactive, login instance of Bash (and other shells).
Thus setting variables in .bashrc
and/or .profile
is guaranteed to set them in any corresponding shell instance. Setting variables in environment.d
files is guaranteed to set them in any corresponding user service instance, which might include shells, but might not (and there might be other intervening layers, see sshd
).
Another difference I see is that changing .bashrc
or .profile
will produce effects in any shell started thereafter; changing environment.d
will only take effect when the user session and the relevant services are reloaded or restarted.
As muru mentioned in the comments, environment.d
files are more limited in their capabilities than the shell initialisation scripts.
/opt/*/bin
and add those to$PATH
, I don't see howenvironment.d
can manage that.