Lists all systemd environment generators in the correct order and with correct semantics.
I wanted to use the systemd environment.d machinery to have the same environment variables for services, SSH sessions and graphical sessions, and systemd's environment.d functionality seemed like a good fit.
However, there was no way to run the environment generators in the correct order specified in
My original approach was to just parse the output of
systemctl show-environment and use that, but it had multiple shortcomings:
So I wrote this. It just lists the generators in the correct order, one per line, which you'd then have to run one after the other and use the output to set your environment variables. This is fairly easy in POSIX-like shells, but takes some handwringing in e.g. Fish.
Note that you should export the variables immediately after running a generator, before even running the next one, since the output of one generator may influence variables set by the next one. This is intended behavior.