nixos/crab-hole: init (#341598)
[NixPkgs.git] / pkgs / development / tools / unityhub / default.nix
blob5a4d94f5022c20206ef4bb0d4a1070bddeb5034a
2   lib,
3   stdenv,
4   fetchurl,
5   dpkg,
6   makeWrapper,
7   buildFHSEnv,
8   extraPkgs ? pkgs: [ ],
9   extraLibs ? pkgs: [ ],
12 stdenv.mkDerivation rec {
13   pname = "unityhub";
14   version = "3.10.0";
16   src = fetchurl {
17     url = "https://hub-dist.unity3d.com/artifactory/hub-debian-prod-local/pool/main/u/unity/unityhub_amd64/unityhub-amd64-${version}.deb";
18     sha256 = "sha256-9dm6tVQ5nsDC8X2clrT4cAl8jg4wLwcihE4bnFgdU+A=";
19   };
21   nativeBuildInputs = [
22     dpkg
23     makeWrapper
24   ];
26   fhsEnv = buildFHSEnv {
27     pname = "${pname}-fhs-env";
28     inherit version;
29     runScript = "";
31     targetPkgs =
32       pkgs:
33       with pkgs;
34       [
35         # Unity Hub binary dependencies
36         xorg.libXrandr
37         xdg-utils
39         # GTK filepicker
40         gsettings-desktop-schemas
41         hicolor-icon-theme
43         # Bug Reporter dependencies
44         fontconfig
45         freetype
46         lsb-release
47       ]
48       ++ extraPkgs pkgs;
50     multiPkgs =
51       pkgs:
52       with pkgs;
53       [
54         # Unity Hub ldd dependencies
55         cups
56         gtk3
57         expat
58         libxkbcommon
59         lttng-ust_2_12
60         krb5
61         alsa-lib
62         nss
63         libdrm
64         mesa
65         nspr
66         atk
67         dbus
68         at-spi2-core
69         pango
70         xorg.libXcomposite
71         xorg.libXext
72         xorg.libXdamage
73         xorg.libXfixes
74         xorg.libxcb
75         xorg.libxshmfence
76         xorg.libXScrnSaver
77         xorg.libXtst
79         # Unity Hub additional dependencies
80         libva
81         openssl
82         cairo
83         libnotify
84         libuuid
85         libsecret
86         udev
87         libappindicator
88         wayland
89         cpio
90         icu
91         libpulseaudio
93         # Unity Editor dependencies
94         libglvnd # provides ligbl
95         xorg.libX11
96         xorg.libXcursor
97         glib
98         gdk-pixbuf
99         libxml2
100         zlib
101         clang
102         git # for git-based packages in unity package manager
104         # Unity Editor 2019 specific dependencies
105         xorg.libXi
106         xorg.libXrender
107         gnome2.GConf
108         libcap
110         # Unity Editor 6000 specific dependencies
111         harfbuzz
112       ]
113       ++ extraLibs pkgs;
114   };
116   unpackCmd = "dpkg -x $curSrc src";
118   dontConfigure = true;
119   dontBuild = true;
121   installPhase = ''
122     runHook preInstall
124     mkdir -p $out
125     mv opt/ usr/share/ $out
127     # `/opt/unityhub/unityhub` is a shell wrapper that runs `/opt/unityhub/unityhub-bin`
128     # Which we don't need and overwrite with our own custom wrapper
129     makeWrapper ${fhsEnv}/bin/${pname}-fhs-env $out/opt/unityhub/unityhub \
130       --add-flags $out/opt/unityhub/unityhub-bin \
131       --argv0 unityhub
133     # Link binary
134     mkdir -p $out/bin
135     ln -s $out/opt/unityhub/unityhub $out/bin/unityhub
137     # Replace absolute path in desktop file to correctly point to nix store
138     substituteInPlace $out/share/applications/unityhub.desktop \
139       --replace /opt/unityhub/unityhub $out/opt/unityhub/unityhub
141     runHook postInstall
142   '';
144   passthru.updateScript = ./update.sh;
146   meta = with lib; {
147     description = "Official Unity3D app to download and manage Unity Projects and installations";
148     homepage = "https://unity.com/";
149     downloadPage = "https://unity.com/unity-hub";
150     changelog = "https://unity.com/unity-hub/release-notes";
151     license = licenses.unfree;
152     maintainers = with maintainers; [
153       tesq0
154       huantian
155     ];
156     platforms = [ "x86_64-linux" ];
157     sourceProvenance = with sourceTypes; [ binaryNativeCode ];
158   };