(English Below)
Salut @12qs1.
Si tu veux utiliser Unreal Engine sur NixOS, je te recommande de passer par ton environnement de projet. J’ai fait un FHS pour builder un projet et lancer Unreal dedans.
Note que tu auras toujours quelques problèmes avec Unreal, notamment pas de Hot Reload et quelques bugs de contrôles (pas possible de taper une recherche dans les blueprints)
J’ai détaillé la méthode ici : UE5 (Unreal Engine 5 Game Engine) · Issue #124963 · NixOS/nixpkgs · GitHub
Il faut :
- Installer VSCode/VSCodium et direnv
- Ajouter le fichier shell.nix suivant au projet :
{ pkgs ? import <nixpkgs> {} }: let
stdenv = pkgs.llvmPackages_18.stdenv;
dotnetPkg = (with pkgs.dotnetCorePackages; combinePackages [
sdk_9_0
]);
deps = (with pkgs; [
zlib
zlib.dev
openssl
dotnetPkg
]);
in
(pkgs.buildFHSEnv {
name = "UnrealEditor";
targetPkgs = pkgs: (with pkgs;
[ udev
alsa-lib
mono
dotnet-sdk
stdenv
clang_18
icu
openssl
zlib
SDL2
SDL2.dev
SDL2 SDL2_image SDL2_ttf SDL2_mixer
vulkan-loader
vulkan-tools
vulkan-validation-layers
glib
libxkbcommon
nss
nspr
atk
mesa
dbus
pango
cairo
libpulseaudio
libGL
expat
libdrm
wayland
]) ++ (with pkgs.xorg;
[
libICE
libSM
libX11
libxcb
libXcomposite
libXcursor
libXdamage
libXext
libXfixes
libXi
libXrandr
libXrender
libXScrnSaver
libxshmfence
libXtst
]);
# runScript = "zsh";
NIX_LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath ([
stdenv
] ++ deps);
NIX_LD = "${stdenv.cc.libc_bin}/bin/ld.so";
nativeBuildInputs = [
] ++ deps;
shellHook = ''
DOTNET_ROOT="${dotnetPkg}";
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1;
'';
}).env
- Ajouter le fichier .envrc suivant au projet :
use nix
# marche aussi avec flakes si tu sais faire
- Activer direnv (
direnv allow
& direnv reload
)
- Générer un projet à partir du terminal
dotnet <PathToEngine>/Engine/Binaries/DotNET/UnrealBuildTool/UnrealBuildTool.dll -ProjectFiles "<PathToProject>/<YourProject>.uproject" -VSCode
- Build le projet en mode Editor
make <YourProject>Editor
# si pas de Makefile, cette commande devrait faire la même chose
"<PathToEngine>/Engine/Build/BatchFiles/RunUBT.sh" <YourProject>Editor Linux Development -Project="<PathToProject>/<YourProject>.uproject"
- Lancer Unreal Engine à partir du terminal
<PathToEngine>/Engine/Binaries/Linux/UnrealEditor -Project="<PathToProject>/<YourProject>.uproject"
English translation:
If you want to use Unreal Engine in NixOS, I recommend using a project build environment. I made one to build a project and run Unreal with it.
Please note you’ll still have inconveniences with Unreal, like the lack of Hot Reload et some input issues (not possible to search terms in blueprints)
I explained how here : UE5 (Unreal Engine 5 Game Engine) · Issue #124963 · NixOS/nixpkgs · GitHub
You will need to :
- install VSCode/VSCodium and direnv
- Add this shell.nix file to your project :
{ pkgs ? import <nixpkgs> {} }: let
stdenv = pkgs.llvmPackages_18.stdenv;
dotnetPkg = (with pkgs.dotnetCorePackages; combinePackages [
sdk_9_0
]);
deps = (with pkgs; [
zlib
zlib.dev
openssl
dotnetPkg
]);
in
(pkgs.buildFHSEnv {
name = "UnrealEditor";
targetPkgs = pkgs: (with pkgs;
[ udev
alsa-lib
mono
dotnet-sdk
stdenv
clang_18
icu
openssl
zlib
SDL2
SDL2.dev
SDL2 SDL2_image SDL2_ttf SDL2_mixer
vulkan-loader
vulkan-tools
vulkan-validation-layers
glib
libxkbcommon
nss
nspr
atk
mesa
dbus
pango
cairo
libpulseaudio
libGL
expat
libdrm
wayland
]) ++ (with pkgs.xorg;
[
libICE
libSM
libX11
libxcb
libXcomposite
libXcursor
libXdamage
libXext
libXfixes
libXi
libXrandr
libXrender
libXScrnSaver
libxshmfence
libXtst
]);
# runScript = "zsh";
NIX_LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath ([
stdenv
] ++ deps);
NIX_LD = "${stdenv.cc.libc_bin}/bin/ld.so";
nativeBuildInputs = [
] ++ deps;
shellHook = ''
DOTNET_ROOT="${dotnetPkg}";
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1;
'';
}).env
- Add this .envrc file to your project:
use nix
# also works with flakes if you know how to make one
- Activate direnv (
direnv allow
& direnv reload
)
- Generate your project from terminal
dotnet <PathToEngine>/Engine/Binaries/DotNET/UnrealBuildTool/UnrealBuildTool.dll -ProjectFiles "<PathToProject>/<YourProject>.uproject" -VSCode
- Build the project in Editor mode
make <YourProject>Editor
# this should run a similar command, if you don't have it
"<PathToEngine>/Engine/Build/BatchFiles/RunUBT.sh" <YourProject>Editor Linux Development -Project="<PathToProject>/<YourProject>.uproject"
- Run Unreal Engine from terminal
<PathToEngine>/Engine/Binaries/Linux/UnrealEditor -Project="<PathToProject>/<YourProject>.uproject"