Keyboard Maestro converts any variables that start with ENV_ into environment variables when it launches sub-processes.
So you just need to create a Keyboard Maestro variable ENV_NIX_USER_PROFILE_DIR
(and the others).
Since variables are permanent, you can just create them, but since they are easy to delete, I would probably create a macro that just contained a bunch of Set Variable to Text actions to set the various variables so you have it well documented what you are intending.