NixOS - Packaging Vision Client and Perspective Workstation

Hey,

I'm trying to package the Vision Client / Perspective Workstation for NixOS in order to build reproducible kiosks.

I've got the Vision Client working with the following package config. It's just been a bunch of trial and error to discover the targetPkgs required to run, but I've got both the launcher and the client working:

# vision-client.nix
{
  pkgs,
  stdenv,
  buildFHSEnv,
}:
let

  pname = "vision-client";
  version = "8.1.43";

  src = pkgs.fetchzip {
    name = "vision-client";
    url = "https://files.inductiveautomation.com/release/ia/8.1.43/20240820-1049/visionclientlauncher.tar.gz";
    curlOpts = "--referer https://inductiveautomation.com/downloads/ignition";
    sha256 = "sha256-UdzpFCPAGtzh/6PdHg520ioOVtFWSv+OnDJmInWwbts=";   
  };

in buildFHSEnv {

  inherit pname version;
  runScript = "${src}/app/visionclientlauncher.sh";

  targetPkgs = pkgs: with pkgs; [
    fontconfig
    glib
    gtk3
    zlib
    xorg.libX11
    xorg.libXcursor
    xorg.libXext
    xorg.libXi
    xorg.libXtst
    xorg.libXrender
  ];
}

Now I'm trying to do the same for Perspective Workstation but I've hit a dead end. The launcher loads, but when launching a client I get the following error and I don't know what else to try. I figure it's probably another missing dependency, but the log is not very helpful:

20240908_200830

ERROR [BrowserUtils                  ] [2024/09/08 23:55:32]: Failed to start Browser Engine with options
 com.teamdev.jxbrowser.engine.EngineOptions:
  autoplayEnabled: true
  chromiumDir: /home/kiosk/.ignition/cache/resources/jxbrowser/7.12.1
  chromiumSwitches: []
  diskCacheSize: <unknown>
  fileAccessFromFilesAllowed: false
  isGpuDisabled: false
  isIncognitoEnabled:false
  language:en-us
  passwordStore: <unknown>
  remoteDebugginPort: 9224
  renderingMode: HARDWARE_ACCELERATED
  isSandboxDisabled: false
  secureOriginWhitelist: []
  isTouchMenuEnabled: true
  userAgent: <unknown user agent value>
  userDataDir:/home/kiosk/.ignition/clientlauncher-data/workstationUserData/2
  webSecurityDisabled: false
.
com.teamdev.jxbrowser.engine.ChromiumProcessStartupFailureException: Process exit code: 127
        at com.teamdev.jxbrowser.engine.internal.EngineImpl.throwExceptionAndCleanup(EngineImpl.java:478)
        at com.teamdev.jxbrowser.engine.internal.EngineImpl.newInstance(EngineImpl.java:281)
        at com.teamdev.jxbrowser.engine.Engine.newInstance(Engine.java:106)
        at com.inductiveautomation.ignition.launcher.workstation.utils.BrowserUtils.lambda$getOrCreateEngine$34(BrowserUtils.java:575)
        at com.inductiveautomation.ignition.launcher.workstation.utils.BrowserUtils.runResourceLockedAction(BrowserUtils.java:996)
        at com.inductiveautomation.ignition.launcher.workstation.utils.BrowserUtils.getOrCreateEngine(BrowserUtils.java:575)
        at com.inductiveautomation.ignition.launcher.workstation.utils.BrowserUtils.getOrCreateEngine(BrowserUtils.java:614)
        at com.inductiveautomation.ignition.launcher.workstation.utils.BrowserUtils.lambda$openAsyncImpl$13(BrowserUtils.java:306)
        at com.inductiveautomation.ignition.launcher.common.service.SimpleService$1.call(SimpleService.java:23)
        at javafx.concurrent.Task$TaskCallable.call(Task.java:1426)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at javafx.concurrent.Service.lambda$executeTask$6(Service.java:728)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at javafx.concurrent.Service.lambda$executeTask$7(Service.java:727)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)

Here's the current Perspective Workstation config:

# perspective-workstation.nix
{
  pkgs,
  stdenv,
  buildFHSEnv,
  writeScript,
}:
let

  pname = "perspective-workstation";
  version = "8.1.43";

  src = pkgs.fetchzip {
    name = "perspective-workstation";
    url = "https://files.inductiveautomation.com/release/ia/8.1.43/20240820-1049/perspectiveworkstation.tar.gz";
    curlOpts = "--referer https://inductiveautomation.com/downloads/ignition";
    sha256 = "sha256-4N2P+rUopcZliRjIWDJhi6GdtcKN1qrayqj2Ur89ikU=";   
  };

in buildFHSEnv {

  inherit pname version;
  runScript = "${src}/app/perspectiveworkstation.sh";

  targetPkgs = pkgs: with pkgs; [
    fontconfig
    glib
    gtk3
    zlib
    xorg.libxcb
    xorg.libX11
    xorg.libXcursor
    xorg.libXext
    xorg.libXi
    xorg.libXtst
    xorg.libXrender
  ];
}

Any suggestions?

Chromium in kiosk mode is easy, but it'd be fun to say I have both first-party launchers working.

1 Like

did you ever figure this out?

Nope, we ultimately gave this up :disappointed_face:

I still think this is a good idea though, I'm open to working on this again.
No big push at the moment though.

Shameless plug, but the perspective kiosk is pretty easy.

2 Likes

I looked into this a few years ago. The included JxBrowser library includes some libraries that need to get unzipped, have their ELF libraries and executables patched manually with patchelf, rezipped then included back in the original JAR file (I think, I haven’t looked into this in years). The next problem is that JxBrowser then compares the deployed resources with a known good file hash, which no gets invalidated. This is where I got blocked when I was looking into this.

This should mostly be correct, I am a bit foggy on the details.

That matches what I was running into.

Getting the Vision client launcher to run wasn’t too bad, however.

This is fantastic. I got it up and running on Ubuntu. However, I am running into the color of one of my animated fans is not correct. Since I cannot inspect the page I’m not sure how to troubleshoot. The following are animated fans on a currently working page. However, on the kiosk mode, they just show up as grey. Any ideas?

Probably worth noting the color comes from a “filter:sepia(40%) hue-rotate(100deg) saturate(10)” Prop.

**** After looking into it, the filter is being overwritten by the a url prop, but only in the kiosk hmi.

Are you using chromium or Firefox as the browser in the end?

I just followed that guide exactly on a fresh install of Ubuntu LTS Server edition. Never deliberately installed chromium or firefox.

You might need to use nix-ld for this. I have only used NixOS a bit but I have some friends that are more experienced with packaging programs for Nix.

I might give this a try over the weekend and see if I can get it working. Let me know if you try out nix-ld and if you have any luck :grinning_face_with_smiling_eyes:

Perhaps try the script in this post, we definitely found a couple of issues with the initial method later on in the topic and tried other methods with success.