NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.28k stars 13.53k forks source link

Package request: Bitfocus Companion #232941

Open JerrySM64 opened 1 year ago

JerrySM64 commented 1 year ago

Bitfocus Companion enables the reasonably priced Elgato Streamdeck to be a professional shotbox surface for an increasing amount of different presentation switchers, video playback software and broadcast equipment.

Bitfocus Companion let's you turn your Elgato Stream Deck into a supercharged macro keyboard. It even let's you do more things with it than the official Stream Deck software on Windows does.

Metadata

alex800121 commented 5 months ago

I attempted to package this app, but encountered some problem when vite needs a display server and cannot be run in a nix build sandbox, which is a headless environment.

VuiMuich commented 4 months ago

AFAIK the aur package installs as headless only, so I wouldn't mind if the NixOS one does as well. The only thing that would be nice to have is a module that starts companion via a service and has a config option to define the directory where development companion-modules are. I believe the companionship-pi could serve as reference here.

alex800121 commented 4 months ago

I attempted to package this app, but encountered some problem when vite needs a display server and cannot be run in a nix build sandbox, which is a headless environment.

Turns out the vite I tried to use was different from the vite that is downloaded in the package, so this is a non-issue.

AFAIK the aur package installs as headless only, so I wouldn't mind if the NixOS one does as well. The only thing that would be nice to have is a module that starts companion via a service and has a config option to define the directory where development companion-modules are. I believe the companionship-pi could serve as reference here.

The companion-pi package downloads the prebuilt binary from the bitfocus website, which works fine in an FHS environment, but it's not an ideal solution. I attempted to follow the build instructions provided in the companion package, which can build the headless version alone, and it builds fine with yarn in an FHS environment. However, the yarn build steps pull in way too many dependencies to work with a pure environment. I guess FOD is the way to go?

ebdavison commented 2 months ago

I am also quite interested in this and would like to know the status of this.

I have tried to do this with nix-shell but am running into a dependency on libX11 which I cannot seem to solve.

{ pkgs ? import <nixpkgs> {} }:
(pkgs.buildFHSUserEnv {
  name = "pipzone";
  targetPkgs = pkgs: (with pkgs; [
    glib
    nss
    nspr
    dbus
    atk
    cups
    libdrm
    gtk3
    pango
    cairo
    #xorg
    #libX11
]);
  runScript = "bash";
      profile = ''
       export LD_LIBRARY_PATH=${pkgs.glibc}/lib
     '';
}).env

This is the error I am getting right now:

└─Δ ./companion-launcher
./companion-launcher: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory
VuiMuich commented 1 month ago

I am also quite interested in this and would like to know the status of this.

I have tried to do this with nix-shell but am running into a dependency on libX11 which I cannot seem to solve. [...] This is the error I am getting right now:

└─Δ ./companion-launcher
./companion-launcher: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory

Thanks for this idea, I went ahead and managed to resolve any further dependencies with this:

{ pkgs ? import <nixpkgs> {} }:
(pkgs.buildFHSUserEnv {
  name = "pipzone";
  targetPkgs = pkgs: (with pkgs; [
    glib
    nss
    nspr
    dbus
    atk
    cups
    libdrm
    gtk3
    pango
    cairo
    xorg.libX11
    xorg.libXcomposite
    xorg.libXdamage
    xorg.libXext
    xorg.libXfixes
    xorg.libXrandr
    xorg.libxcb
    libxkbcommon
    libudev-zero
    libusb1
    fontconfig
    alsaLib
    mesa
    expat
    corepack_18
    nodejs-18_x
]);
  runScript = "bash";
      profile = ''
       export LD_LIBRARY_PATH=${pkgs.glibc}/lib
     '';
  buildInputs = [ pkgs.corepack_18 pkgs.nodejs-18_x ];
}).env

to run it works either to run the companion-launcher or the companion_headless.sh scripts. For the headless version you can use these flags:

--list-interfaces, 'List the available network interfaces that can be passed to --admin-interface'
--admin-port <number>, 'Set the port the admin ui should bind to, 8000
--admin-interface <string>', 'Set the interface the admin ui should bind to. The first ip on this interface will be used'
--admin-address <string>, 'Set the ip address the admin ui should bind to (default: "0.0.0.0")
--config-dir <string>', 'Use the specified directory for storing configuration. The default path varies by system, and is different to 2.2 (the old path will be used if existing config is found)'
--extra-module-path <string>, 'Search an extra directory for modules to load'
--machine-id <string>, 'Unique id for this installation'
--log-level <string>, 'Log level to output to console'

Things I haven't tested yet:

Edit: added corepack and nodejs as buildinputs and with this I was able to use yarn build on a companion module, so I guess module development should work with this shell as well...