openDsh / dash

Join us on Slack! https://join.slack.com/t/opendsh/shared_invite/zt-la398uly-a6eMH5ttEQhbtE6asVKx4Q
GNU General Public License v3.0
238 stars 69 forks source link

Add initial nix build support #156

Open nakato opened 4 months ago

nakato commented 4 months ago

I'm not sure why install.sh builds bluez from source rather than taking the system packaged one, but it's a good example of one of the ways nix will be really useful here. If we needed to change bluez, we can do so without conflicting with the system bluez that is installed. The same goes for OpenSSL. While I've elected to take a patch to allow the use of the latest OpenSSL, the references to OpenSSL could easily be changed from openssl to openssl_3_0. Protobuf is pinned, as newer version require building with C++ 17 or greater by editing CMakeLists.txt to contain SET(CMAKE_CXX_STANDARD 17).

Currently, this lacks a devShell, and I'd like to leave that for a future followup as it's not something I have much experience with currently. Build environments for individual packages can be realised by requesting one for the package in question. nix develop -L .#packages.<SYSTEM>.<PACKAGE>, and is mostly useful to run through nix build phases, rather than being a generic dev environment.

Dash can be built on x86_64 with, nix build -L .#packages.x86_64-linux.openDsh_dash_nonnixos, and a symlink to the store location will be at ./result.

It might make since to move the package declarations of aasdk and openauto to the respective packages as it would likely make overriding them locally easier as it would be possible to pass --override-input with a path during nix flake lock, but that also complicates the handling of qtgstreamer and h264bitstream, and makes it more difficult to see how this all works together, so it's probably also better as a change to be made when that added complexity comes with a clear benefit.

For non-NixOS, openDsh_dash_nonnixos is the package to use as it's a script that is wrapping the dash executable to include opengl drivers from nixpkgs. I tested this with the latest Raspberry Pi OS (bookworm) on a RPi4 4GB, and launched dash from a Sway (Wayland) environment.

nakato commented 2 months ago

I haven't touched the SBC I was checking this on in a while as I stalled out on a panic occurring in u-boot. That's obviously unrelated to this work, but I don't want to wipe my SD card and loose the ability to reproduce the issue.

To summarise the current state as the opening is pretty long:
The flake produces a working Dash binary for use on non NixOS distros with Nix installed and Dash and OpenAuto on NixOS. It's been tested on Ubuntu and NixOS on a RPi4 and on NixOS on an x86_64 laptop.