Change:
Project description Unity is changing the way they deliver the editor via the UnityHub. They have shifted away from the appimage and have started Debian and RHEL repositories. They are not producing the appimage anymore. Would it be possible to add the new UnityHub to NixOS? The new download instructions are here:
Extracting the binary from the .deb is fairly simple and has been done in similar situations in nixpkgs before.
Is there any quick fix to use unity right now?
Not that I have found. You could use an old version of the appimage if you still have one. The flatpak is available but is a really old version.
I am currently building a derivation locally to extract the binary from the .deb package and make it run. Lets see how long it takes
have you had any success? I have but it yells about and crashes when I try to use it
I thought that unityhub is an electron app. My current attempt results in a f mismatch from electron. Here is my . I build it via .
Yeah it is electron but I'm just trying to package the prepackaged electron binary instead of using system electron
Yes you are right. When trying to use the included electron binary it will result in the same error. Hm when I have some time I will investigate with . Or maybe you had any luck?
Unfortunately not, I've seen one other mention of the same error with electron with no solution, and I'm not sure how to do deeper debugging personally.
I've managed to do something: by adding to LDLIBRARYPATH, I can get it to not , but now instead it just hangs... I'll keep trying but I'm not sure what it is this time.
I've made a tad more progress, I forgot to enable gnome-keychain so that was causing the hang, but now it's segfaulting :sweat: I do see it looking for but I'm not sure what that even is
Finally, got it working. It boots up and I can install everything properly. The remaining issue is that hub-installed versions of Unity aren't patched so the hub fails to launch them. It seems that since the previous version used appimages, the library paths were passed to the editor as well as the hub, but I'm not sure how to do it with this. Do I need ? I'll try that but I'm not sure if there's a more optimal solution.
Looking at the code seems to be the way. !
<details open<summaryWeird error I'm getting when I'm trying to open say Preferences or the Package Manager in the unity editor.... I have no idea what this is from, am I missing gtk stuff?</summary<br</details
Hopefully the final bit of the saga, it turns out the GTK issue I had isn't unique to NixOS, it occurs on other distros too, see the . In that case, it seems my derivation for the updated Unity Hub is working properly in all other regards, and can be found . All the need to be cleaned up, I may have a few unnecessary ones, and there's a lot of leftover testing with the QML paths :sweat_smile:. If it looks good, perhaps we can update Unity Hub in nixpkgs too? I've also made a describing how to use Rider with Unity on NixOS as well, might help someone out.
Thanks for that looking forward to seeing that on master!
Hehe thanks for the reminder, forgot to make a PR for updating the package!
I just copied your derivation meanwhile and was the only thing it make unity work (installing the 2021.3.4), thanks!
Hello I use Unity and just tried out file. It works great! However, I cannot find your PR. Would you be able to point me in the right direction? I would love to see this in nixpkgs soon!
I've been kinda busy recently with other prs and such, but I'm definitely planning to make a PR in nixpkgs, if not later today, definitely by this weekend. Thanks for the support :)

Discussion:
<del> { lib, fetchurl, appimageTools  }: </del> <ins> { lib, stdenv, fetchurl, dpkg, makeWrapper, buildFHSUserEnv , extraPkgs ? pkgs: [ ] , extraLibs ? pkgs: [ ] }: </ins> <del> appimageTools.wrapType2 rec { </del> <ins> stdenv.mkDerivation rec { </ins> pname = "unityhub"; <del> version = "2.3.2"; </del> <ins> version = "3.4.1"; </ins> src = fetchurl { <del> # mirror of https://public-cdn.cloud.unity3d.com/hub/prod/UnityHub.AppImage url = "https://archive.org/download/unity-hub-${version}/UnityHub.AppImage"; sha256 = "07nfyfp9apshqarc6pgshsczila6x4943hiyyizc55kp85aw0imn"; </del> <ins> url = "https://hub-dist.unity3d.com/artifactory/hub-debian-prod-local/pool/main/u/unity/unityhub_amd64/unityhub-amd64-${version}.deb"; sha256 = "sha256-/P6gPLSRGfwEN801cyNrZTpHyZKO+4tU6cFvLz8ERuo="; </ins> }; <del> extraPkgs = (pkgs: with pkgs; with xorg; [ gtk2 gdk-pixbuf glib libGL libGLU nss nspr alsa-lib cups libcap fontconfig freetype pango cairo dbus dbus-glib libdbusmenu libdbusmenu-gtk2 expat zlib libpng12 udev tbb libpqxx gtk3 libsecret lsb-release openssl nodejs ncurses5 </del> <ins> nativeBuildInputs = [ dpkg makeWrapper ]; </ins> <del> libX11 libXcursor libXdamage libXfixes libXrender libXi libXcomposite libXext libXrandr libXtst libSM libICE libxcb </del> <ins> fhsEnv = buildFHSUserEnv { name = "${pname}-fhs-env"; runScript = ""; </ins> <del> libselinux pciutils libpulseaudio libxml2 icu clang cacert ]); </del> <ins> # Seems to be needed for GTK filepickers to work in FHSUserEnv profile = "XDG_DATA_DIRS="$XDG_DATA_DIRS:/usr/share/""; </ins> <del> extraInstallCommands = let appimageContents = appimageTools.extractType2 { inherit pname version src; }; in '' install -Dm444 ${appimageContents}/unityhub.desktop -t $out/share/applications substituteInPlace $out/share/applications/unityhub.desktop  --replace 'Exec=AppRun' 'Exec=${pname}' install -m 444 -D ${appimageContents}/unityhub.png  $out/share/icons/hicolor/64x64/apps/unityhub.png ''; </del> <ins> targetPkgs = pkgs: with pkgs; [ xorg.libXrandr # GTK filepicker gsettings-desktop-schemas hicolor-icon-theme # Bug Reporter dependencies fontconfig freetype lsb-release ] ++ extraPkgs pkgs; multiPkgs = pkgs: with pkgs; [ # Unity Hub ldd dependencies cups gtk3 expat libxkbcommon lttng-ust_2_12 krb5 alsa-lib nss_latest libdrm mesa nspr atk dbus at-spi2-core pango xorg.libXcomposite xorg.libXext xorg.libXdamage xorg.libXfixes xorg.libxcb xorg.libxshmfence xorg.libXScrnSaver xorg.libXtst # Unity Hub additional dependencies libva openssl_1_1 cairo xdg-utils libnotify libuuid libsecret udev libappindicator wayland cpio icu libpulseaudio # Editor dependencies libglvnd # provides ligbl xorg.libX11 xorg.libXcursor glib gdk-pixbuf libxml2 zlib clang git # for git-based packages in unity package manager ] ++ extraLibs pkgs; }; unpackCmd = "dpkg -x $curSrc src"; dontConfigure = true; dontBuild = true; installPhase = '' runHook preInstall mkdir -p $out mv opt/ usr/share/ $out # `/opt/unityhub/unityhub` is a shell wrapper that runs `/opt/unityhub/unityhub-bin` # Which we don't need and overwrite with our own custom wrapper makeWrapper ${fhsEnv}/bin/${pname}-fhs-env $out/opt/unityhub/unityhub  --add-flags $out/opt/unityhub/unityhub-bin  --argv0 unityhub # Link binary mkdir -p $out/bin ln -s $out/opt/unityhub/unityhub $out/bin/unityhub # Replace absolute path in desktop file to correctly point to nix store substituteInPlace $out/share/applications/unityhub.desktop  --replace /opt/unityhub/unityhub $out/opt/unityhub/unityhub runHook postInstall ''; </ins> meta = with lib; { <ins> description = "Official Unity3D app to download and manage Unity Projects and installations"; </ins> homepage = "https://unity3d.com/"; <del> description = "Game development tool"; longDescription = '' Popular development platform for creating 2D and 3D multiplatform games and interactive experiences. ''; </del> license = licenses.unfree; <ins> maintainers = with maintainers; [ tesq0 huantian ]; </ins> platforms = [ "x86_64-linux" ]; <del> maintainers = with maintainers; [ tesq0 ]; </del> }; }