1 { lib, stdenv, writeScript, fetchurl, requireFile, unzip, clang, mono, which,
5 deps = import ./cdn-deps.nix { inherit fetchurl; };
6 linkDeps = writeScript "link-deps.sh" (lib.concatMapStringsSep "\n" (hash:
7 let prefix = lib.concatStrings (lib.take 2 (lib.stringToCharacters hash));
9 mkdir -p .git/ue4-gitdeps/${prefix}
10 ln -s ${lib.getAttr hash deps} .git/ue4-gitdeps/${prefix}/${hash}
12 ) (lib.attrNames deps));
13 libPath = lib.makeLibraryPath [
14 xorg.libX11 xorg.libXScrnSaver xorg.libXau xorg.libXcursor xorg.libXext
15 xorg.libXfixes xorg.libXi xorg.libXrandr xorg.libXrender xorg.libXxf86vm
19 stdenv.mkDerivation rec {
22 sourceRoot = "UnrealEngine-${version}-release";
24 name = "${sourceRoot}.zip";
25 url = "https://github.com/EpicGames/UnrealEngine/releases/tag/${version}";
26 sha256 = "1rh6r2z00kjzq1i2235py65bg9i482az4rwr14kq9n4slr60wkk1";
29 ${unzip}/bin/unzip $src
34 # Sometimes mono segfaults and things start downloading instead of being
35 # deterministic. Let's just fail in that case.
36 export http_proxy="nodownloads"
38 patchShebangs Setup.sh
39 patchShebangs Engine/Build/BatchFiles/Linux
41 ./GenerateProjectFiles.sh
45 mkdir -p $out/bin $out/share/UnrealEngine
47 sharedir="$out/share/UnrealEngine"
49 cat << EOF > $out/bin/UE4Editor
54 # Can't include spaces, so can't piggy-back off the other Unreal directory.
55 workdir="\$HOME/.config/unreal-engine-nix-workdir"
56 if [ ! -e "\$workdir" ]; then
58 ${xorg.lndir}/bin/lndir "\$sharedir" "\$workdir"
59 unlink "\$workdir/Engine/Binaries/Linux/UE4Editor"
60 cp "\$sharedir/Engine/Binaries/Linux/UE4Editor" "\$workdir/Engine/Binaries/Linux/UE4Editor"
63 cd "\$workdir/Engine/Binaries/Linux"
64 export PATH="${xdg-user-dirs}/bin\''${PATH:+:}\$PATH"
65 export LD_LIBRARY_PATH="${libPath}\''${LD_LIBRARY_PATH:+:}\$LD_LIBRARY_PATH"
66 exec ./UE4Editor "\$@"
68 chmod +x $out/bin/UE4Editor
72 buildInputs = [ clang mono which xdg-user-dirs ];
75 description = "A suite of integrated tools for game developers to design and build games, simulations, and visualizations";
76 homepage = "https://www.unrealengine.com/what-is-unreal-engine-4";
77 license = lib.licenses.unfree;
78 platforms = lib.platforms.linux;
80 # See issue https://github.com/NixOS/nixpkgs/issues/17162