Asked to give a framework answer this is one way it may be done the key is not to install anything such that all settings are provided at runtime.
Although examples here are for Windows and just part of many scripts suited to each application, the principle is the same on any OS (the terminology and methods may differ)
Note not every part is shown here but should give an idea for setting and chaining interdependent groups of applications without add permanently to one system
Here is a the core loader for MiKTeX so that all variables are added at runtime before any other app such as Python SageMath etc
@echo off
:: Ensure HOME is set OUTSIDE system default (consider if it needs to be RESET)
set HOME=%HOMEDRIVE%%HOMEPATH%\HOME
:: Prepare TeX environment this is for a windows portable installation (need similar scripting for bash)
set GS=%~d0\Apps\Graphics\Artifex\gs9.26
set IMAGEMAGICK=%~d0\LyX-23\LyX-232-2\imagemagick
set INKSCAPE=%~d0\Apps\Graphics\inkscape\0.92.3xp\App
set MIKTEX=%~d0\MiKTeX app
set PERL=%~d0\LyX-23\LyX-232-2\Perl
:: Use a TeXmf specific to MiKTeX keep separate from the TeX Live/W32TeX one
set TEXMF=%MIKTEX%\texmf-local
:: Need a similar list of alias for nix
set PATH=%MiKTeX%\texmfs\install\miktex\bin;%inkscape%\inkscape;%imagemagick%;%GS%;%GS%\x32\bin;%Perl%\bin;%path%
echo About to start MiKTeX console in background (Ctrl-C to abort)
pause
:: ENSURE Update font mapping as system font mapping may have changed
start " " "%~d0\MiKTeX app\texmfs\install\miktex\bin\miktex-console" --mkmaps
echo Please update MiKTeX Packages / Use TeXworks
echo or press any key to continue to secondary shell
pause > nul:
:: Add choice of editor or other supporting apps here
cmd /k
An alternative script for Tex Live can be run so that all variables are added at runtime before any other app such as Python SageMath etc
If I wish to run ANKI on top of MiKTeX (or TeX Live) then this one calls the other
:: The standard Anki builds use hardware acceleration by default, and the ALTernate builds do not.
:: If you experience graphical issues, or problems starting Anki, changing the hardware acceleration setting
:: in Anki’s preferences screen may help. If Anki shows an error message on startup on Windows and restarting
:: it a few times does not help, you can manually change the video driver by running the following in cmd.exe:
:: may need one time EITHER OR ?
:: echo auto > %APPDATA%\Anki2\gldriver
:: echo angle > %APPDATA%\Anki2\gldriver
:: Note this is the ALT version so above should not be needed
set ANKI=%~d0\anki\anki_alt
echo The ANKI undo shortcut is different in the alternate version due to an issue with the toolkit.
echo You can discover the alternate shortcut by looking at the Edit menu of the main screen.
echo The toolkit ANKI uses can have trouble with cut and paste when other clipboard programs are running.
:: use default MiKTeX script which loads Artifex Ghostscript 9.2, ImageMagik (convert), Inkscape 0.9, Perl 5.24.2
CALL \Miktex App\MIKTEX-RUN
set ANKI_WEBSCALE=1
:: will alter the scale of Anki’s web views (like the deck list, study screen, etc), while leaving interface elements like the menu bar alone. Replace 1 with the desired scale, such as 1.5 or 2.
:: set ANKI_NOHIGHDPI=1
:: will turn off some of Qt’s high dpi support
following is for proxy issues (beware security compromise)
:: set ANKI_NOVERIFYSSL=1
start /b %~d0\anki\anki_alt\anki.exe -b %~d0\anki\data
pause