Install vrchat specific unity version

This commit is contained in:
2025-10-23 17:14:38 -04:00
parent cb4def1f42
commit e39e3aff80
2 changed files with 68 additions and 1 deletions

View File

@ -22,10 +22,13 @@
home.packages = with pkgs; [
tmux
inputs.oscgoesbrrr.packages.${system}.default
alcom
vesktop
# inputs.nixgl.nixGLIntel
# htop
#inputs.baballonia.${system}.default
];
] ++ lib.optionals (system == "x86-linux") (import ./unity_vrchat.nix {pkgs = pkgs; }).packages;
# Wayvr customization
xdg.configFile."wlxoverlay/openxr_actions.json5" = {

64
unity_vrchat.nix Normal file
View File

@ -0,0 +1,64 @@
{ pkgs, ... }:
let
# Define a unityhub that includes fonts.
unityhub = pkgs.unityhub.override { extraPkgs = pkgs: [pkgs.corefonts pkgs.ipafont]; };
in {
packages = [
unityhub
(pkgs.stdenvNoCC.mkDerivation rec {
pname = "unity";
version = "2022.3.22f1";
dontFixup = true;
unitySrc = pkgs.fetchurl {
url = "https://download.unity3d.com/download_unity/887be4894c44/LinuxEditorInstaller/Unity-2022.3.22f1.tar.xz";
hash = "sha256-eE//d2kFHA9p7bA52NCUMeeuQASmSh20QDcJ3biKpQY=";
};
androidSupportSrc = pkgs.fetchurl {
url = "https://download.unity3d.com/download_unity/887be4894c44/MacEditorTargetInstaller/UnitySetup-Android-Support-for-Editor-2022.3.22f1.pkg";
hash = "sha256-Vqk8HgnFsUzjLvjIhIdJTLFHpyE6UDhwR7hN7/Jjpak=";
};
windowsSupportSrc = pkgs.fetchurl {
url = "https://download.unity3d.com/download_unity/887be4894c44/MacEditorTargetInstaller/UnitySetup-Windows-Mono-Support-for-Editor-2022.3.22f1.pkg";
hash = "sha256-iBGBpsg3IwooTqQSC/y14qq5QLuQEOvftQ07iGXCBZ0=";
};
nativeBuildInputs = [ pkgs.cpio pkgs.xarMinimal ];
buildInputs = [ unityhub.fhsEnv ];
unpackPhase = ''
mkdir android
xar -C android -xf "${androidSupportSrc}"
mkdir windows
xar -C windows -xf "${windowsSupportSrc}"
'';
installPhase = ''
# This Editor/version/Editor path helps Unity Hub recognize the version of the editor.
mkdir -p "$out/bin" "$out/Editor/${version}/Editor/Data/PlaybackEngines/AndroidPlayer" "$out/Editor/${version}/Editor/Data/PlaybackEngines/WindowsStandaloneSupport"
tar -C "$out/Editor/${version}" -xf "${unitySrc}"
gzip -d < android/TargetSupport.pkg.tmp/Payload | cpio -iD "$out/Editor/${version}/Editor/Data/PlaybackEngines/AndroidPlayer"
gzip -d < windows/TargetSupport.pkg.tmp/Payload | cpio -iD "$out/Editor/${version}/Editor/Data/PlaybackEngines/WindowsStandaloneSupport"
# Create unity wrapper script
cat > "$out/bin/unity" <<-EOF
#!/bin/sh
exec -a "$out/Editor/${version}/Editor/Unity" "${unityhub.fhsEnv}/bin/unityhub-fhs-env" "$out/Editor/${version}/Editor/Unity" "\$@"
EOF
chmod a+x "$out/bin/unity"
# Fix font fallback
cat > "$out/Editor/${version}/Editor/Data/Resources/fontsettings.txt" <<-EOF
English|default=Inter, IPAPGothic, Verdana, Tahoma
English|Inter-Regular=Inter, IPAPGothic, Verdana, Tahoma
English|Inter-SemiBold=Inter, IPAPGothic, Verdana, Tahoma
English|Inter-Small=Inter, IPAPGothic, Verdana, Tahoma
English|Inter-Italic=Inter, IPAPGothic, Verdana, Tahoma
English|Inter-SemiBoldItalic=Inter, IPAPGothic, Verdana, Tahoma
EOF
'';
})
];
}