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