@@ 0,0 1,21 @@
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 `systemd.environment-generator(7)`.
My original approach was to just parse the output of `systemctl show-environment` and use that, but it had multiple shortcomings:
- It included read-only variables that I had to filter out
- It resulted in duplicate entries in `PATH`-like variables
- It generally contained lots of edge cases that I might want to handle differently, like `DBUS_SESSION_BUS_ADDRESS`
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.