Nix Derivation with multiple sources

tldr: Is there a good resource to read about building derivations for software packages which deals with multiple github sources?

Detail:
I would like to build a package for my AR glasses which is here:

This package is a combination of a driver for the AR Glasses and some utilities to use this driver with a shader to allow gaming (and in future productivity) with a fixed display.

The package requires a few other repositories which are part of the same user’s github. I think I understand how to get each piece built, as well as how to give them any requirements from nixpkgs. What I do not understand and cannot find an example for is getting the various pieces to work together when they are not in nixpkgs…ie how do I build all of this to work together?

Just a side note: I was able to build the driver using the instructions from an issue which was opened within its repository and it works great, but now I would like the shader too. Repo of driver:

Hi @canguy247 these are my repos and I’d be happy to discuss how it all ties together. It’s a bit obfuscated (unintentionally) by the fact that it’s using a Vulkan implicit layer and communicating by broadcasting data over an IPC channel that’s meant to be generic so anyone can build an app that listens to the IMU on the glasses. At the moment, the stack is this:

  • ReShadeFX shaders (wheaney/sombrero) - take the rendered screen from the game and modify it based on IMU headset orientation
  • vkBasalt (wheaney/vkBasalt) - fork of the vkBasalt library that reads data from IPC shared memory and passes it to the shader. this library’s main job, though, is as the Vulkan implicit layer that injects my shader into any running Vulkan apps
  • XRLinuxDriver (wheaney/XRLinuxDriver) - orchestrates user configuration and control flags with device IMU data (currently supports XREAL and VITURE device SDKs) to provide XR functionality, which in some cases (e.g. Virtual display and Smooth Follow modes) entails writing data to IPC shared memory for any app to consume (but for the current purposes, we can safely assume that the vkBasalt library is the consumer)
  • device driver/SDK libraries (TheJackiMonster/nrealAirLinuxDriver for XREAL and proprietary binary for VITURE)

If you look at breezy-desktop’s bin/package_vulkan script, you’ll see how it’s all built and packaged together, and the vulkan/bin/setup script shows how it’s all installed from the archive; most of the setup is putting vkBasalt binaries and configs in the right locations, installing the reshade shaders and config for vkBasalt to utilize, and lastly installing the XRLinuxDriver (still called xrealAirLinuxDriver internally, to-be-renamed eventually), which involves putting some binaries and scripts in ~/bin and setting up a systemd service so the app can be always-running and wait for a supported device to be plugged in.

Let me know what else I can clarify for you.

1 Like

Hey @wheaney, thanks for the info!

I dug through the files and the issue here is my lack of knowledge with derivations. Your repo has sub-modules within sub-modules and I am not sure how to handle that. I think I have to override the buildPhase, and then use the installPhase to move things around after. I have to do some more reading :slight_smile:

I am at the point where I have all of the files, including all sub-modules, pulled down during the build (ie the super easy part) now I just need to figure out the next step.