Running Graphical Applications With MSG

Table of Contents

🔙

Intro

While MSG comes out of the box with mainly cli tooling, you are also able to forward graphical X11 applications from MSG to the MacOS host running Xquartz.

Setup Environment


Install Xquartz

Configure Xquartz

  • Open Xquartz and use the Menu Bar to access the settings

Screenshot-xquartz-settings.png

  • Select the Security tab

screenshot-xquartz-tabs.png

  • Enable "Allow connections from network clients"

screenshot-xquartz-setting.png

  • Reboot your Mac

Update MSG Environment

  • Run the MSG Guix application
  • Enter the MSG shell using guix shell
  • Run guix pull followed by sudo guix system reconfigure /etc/config.scm
  • Reboot with sudo reboot

Install App to Run


Try Running without Desktop dependencies

The simplest way to run graphical applications is with the base MSG environment. This works well for some apps, while others might require more desktop dependencies. If the app isn't running correctly, see the directions below.

Install an Application

  • Enter the MSG environment using guix shell
  • Here you will install a new application. In this example we will install Emacs since it runs well without desktop dependencies.
  • guix install emacs

Run the application

  • The easiest way to run the application is to simply execute it's command while inside the MSG shell. In this case we would just run emacs.
  • Another method is to use the alias guix app from the MacOS host. This would look something like guix app emacs.

Use the app!

  • The application should startup and appear in a native X11 window on the MacOS host.
    • Note: if application is not found, make sure to run the following:

      GUIX_PROFILE="/home/admin/.guix-profile"
       . "$GUIX_PROFILE/etc/profile"
      

screenshot-emacs-x11.png


Run with Desktop Dependencies 🚧 (sound isn't working for some apps)

If your application is missing certain dependencies or isn't functioning correctly, it is likely that it is missing some desktop dependencies that MSG doesn't ship with.

Edit your config.scm

  • The config.scm file is located at /etc/config.scm. Open the file with your favorite text editor (Working emacs install instructions above).
Add desktop service module
  • Update the (use-service-modules ...) line to include desktop like the line below
(use-service-modules avahi desktop networking ssh shepherd)
Add xfce to package list
  • xfce seems to produce the best results with Xquartz, so we will want to add it to the package definition. The full package definition should look like:

    (packages (append (map specification->package
                            '("tmux" "nss-certs" "vim" "wget" "cmake" "make" "gcc-toolchain" "xfce")) %base-packages))
    
Remove the following service types from the services block
  • (service network-manager-service-type)
  • (service wpa-supplicant-service-type)
  • (service avahi-service-type)
  • (service ntp-service-type)
Add the following service line
  • (service xfce-desktop-service-type)
Update the base services
  • Change the section %base-services to %desktop-services

Reconfigure MSG

  • Run sudo guix system reconfigure /etc/config.scm
  • Restart MSG with sudo reboot

Start xfce4 session

  • Enter the MSG shell from MacOS using guix shell
  • Run the following command: startxfce4
    • This will start an xfce4 session in X11. You can move the panels to a more manageable position by right clicking on them and going into the panel properties.

Install an App

  • Using either the xfce4 terminal or another shell into MSG, install your application with guix install <package-name>
  • You should now be able to run your application with either guix app from MacOS, or just by invoking the application from the xfce-terminal.