Skip to content

Commit 2d14b04

Browse files
committed
Make installer compatible with electron + nix flake
1 parent 90e8433 commit 2d14b04

4 files changed

Lines changed: 117 additions & 95 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/result

flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
description = "Build environment for SlimeVR-Installer";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs = { self, nixpkgs, flake-utils }:
10+
flake-utils.lib.eachDefaultSystem (system:
11+
let
12+
pkgs = import nixpkgs { inherit system; };
13+
in
14+
{
15+
packages.default = pkgs.stdenv.mkDerivation {
16+
pname = "slimevr-installer";
17+
version = "1.0.0";
18+
src = ./.;
19+
20+
nativeBuildInputs = [ pkgs.nsis ];
21+
22+
buildPhase = ''
23+
makensis windows/web/slimevr_web_installer.nsi
24+
'';
25+
26+
installPhase = ''
27+
mkdir -p $out
28+
cp windows/web/slimevr_web_installer.exe $out/
29+
'';
30+
};
31+
32+
devShells.default = pkgs.mkShell {
33+
buildInputs = with pkgs; [
34+
nsis
35+
wineWow64Packages.stable
36+
];
37+
38+
shellHook = ''
39+
echo "SlimeVR Installer Dev Shell"
40+
echo "Run 'makensis <file>.nsi' to compile manually."
41+
'';
42+
};
43+
});
44+
}

windows/web/slimevr_web_installer.nsi

Lines changed: 11 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ Unicode True
3939
!define MVCDLURL "https://aka.ms/vc14/vc_redist.x64.exe"
4040
!define MVCDLFileZip "vc_redist.x64.exe"
4141

42-
!define WV2Version ""
43-
!define WV2URLType "url" ; "url" or "local"
44-
!define WV2DLURL "https://go.microsoft.com/fwlink/p/?LinkId=2124703"
45-
!define WV2DLFileZip "MicrosoftEdgeWebView2RuntimeInstaller.exe"
4642
# Define the Java Version Strings and to Check (JRE\relase -> JAVA_RUNTIME_VERSION=)
4743
!define JREVersion "17.0.17+10"
4844
!define JREURLType "url" ; "url" or "local"
@@ -89,7 +85,7 @@ InstallDir "$PROGRAMFILES\SlimeVR Server" ; $InstDir default value. Defaults to
8985
ShowInstDetails show
9086
ShowUninstDetails show
9187

92-
BrandingText "SlimeVR Installer 3.0.0"
88+
BrandingText "SlimeVR Installer 4.0.0"
9389

9490
# Admin rights are required for:
9591
# 1. Removing Start Menu shortcut in Windows 7+
@@ -149,36 +145,14 @@ FunctionEnd
149145

150146
Function .onInstFailed
151147
${If} $SELECTED_INSTALLER_ACTION == ""
152-
Call cleanInstDir
148+
RMDir /r $INSTDIR
153149
${Endif}
154150
FunctionEnd
155151

156152
Function .onGUIEnd
157153
Call cleanTemp
158154
FunctionEnd
159155

160-
Function cleanInstDir
161-
Delete "$INSTDIR\uninstall.exe"
162-
Delete "$INSTDIR\run.bat"
163-
Delete "$INSTDIR\run.ico"
164-
Delete "$INSTDIR\slimevr*"
165-
Delete "$INSTDIR\firewall*.bat"
166-
Delete "$INSTDIR\MagnetoLib.dll"
167-
Delete "$INSTDIR\steamvr.ps1"
168-
Delete "$INSTDIR\log*"
169-
Delete "$INSTDIR\*.log"
170-
Delete "$INSTDIR\*.lck"
171-
Delete "$INSTDIR\vrconfig.yml"
172-
Delete "$INSTDIR\LICENSE*"
173-
174-
RMDir /r "$INSTDIR\Recordings"
175-
RMdir /r "$INSTDIR\jre"
176-
RMdir /r "$INSTDIR\driver"
177-
RMDir /r "$INSTDIR\logs"
178-
RMdir /r "$INSTDIR\Feeder-App"
179-
180-
RMDir $INSTDIR
181-
FunctionEnd
182156
# Init functions end #
183157

184158
Page Custom startPage startPageLeave
@@ -311,15 +285,15 @@ Function endPageLeave
311285
${If} $0 = 1
312286
CreateDirectory "$SMPROGRAMS\SlimeVR Server"
313287
CreateShortcut "$SMPROGRAMS\SlimeVR Server\Uninstall SlimeVR Server.lnk" "$INSTDIR\uninstall.exe"
314-
CreateShortcut "$SMPROGRAMS\SlimeVR Server\SlimeVR Server.lnk" "$INSTDIR\slimevr.exe" ""
288+
CreateShortcut "$SMPROGRAMS\SlimeVR Server\SlimeVR Server.lnk" "$INSTDIR\SlimeVR.exe" ""
315289
${Else}
316290
Delete "$SMPROGRAMS\Uninstall SlimeVR Server.lnk"
317291
Delete "$SMPROGRAMS\SlimeVR Server.lnk"
318292
RMdir /r "$SMPROGRAMS\SlimeVR Server"
319293
${Endif}
320294

321295
${If} $1 = 1
322-
CreateShortcut "$DESKTOP\SlimeVR Server.lnk" "$INSTDIR\slimevr.exe" ""
296+
CreateShortcut "$DESKTOP\SlimeVR Server.lnk" "$INSTDIR\SlimeVR.exe" ""
323297
${Else}
324298
Delete "$DESKTOP\SlimeVR Server.lnk"
325299
${EndIf}
@@ -330,7 +304,7 @@ Function endPageLeave
330304

331305
${If} $3 = 1
332306
# use explorer to open it so it inherits the user token and starts as normal user
333-
Exec '"$WINDIR\explorer.exe" "$INSTDIR\slimevr.exe"'
307+
Exec '"$WINDIR\explorer.exe" "$INSTDIR\SlimeVR.exe"'
334308
${EndIf}
335309

336310
FunctionEnd
@@ -449,44 +423,21 @@ Section "SlimeVR Server" SEC_SERVER
449423
SetOutPath $INSTDIR
450424

451425
!insertmacro dlFile "${SVRServerURLType}" "SlimeVR Server" "${SVRServerVersion}" "${SVRServerDLURL}" "${SVRServerDLFileZip}"
452-
!insertmacro unzipFile "SlimeVR Server" "${SVRServerVersion}" "${SLIMETEMP}\${SVRServerDLFileZip}" "${SLIMETEMP}\SlimeVR"
453426

454-
${If} $SELECTED_INSTALLER_ACTION == "update"
455-
Delete "$INSTDIR\slimevr-ui.exe"
456-
${EndIf}
427+
CreateDirectory "${SLIMETEMP}\SlimeVR"
428+
!insertmacro unzipFile "SlimeVR Server" "${SVRServerVersion}" "${SLIMETEMP}\${SVRServerDLFileZip}" "${SLIMETEMP}\SlimeVR"
457429

458430
DetailPrint "Copying SlimeVR Server to installation folder..."
459-
CopyFiles /SILENT "${SLIMETEMP}\SlimeVR\SlimeVR\*" $INSTDIR
460-
461-
IfFileExists "$INSTDIR\slimevr-ui.exe" found not_found
462-
found:
463-
Delete "$INSTDIR\slimevr.exe"
464-
Rename "$INSTDIR\slimevr-ui.exe" "$INSTDIR\slimevr.exe"
465-
not_found:
431+
CopyFiles /SILENT "${SLIMETEMP}\SlimeVR\*" $INSTDIR
466432

467433
Delete "$INSTDIR\run.bat"
434+
Delete "$INSTDIR\slimevr-ui.exe"
468435
Delete "$INSTDIR\run.ico"
469436

470437
# Create the uninstaller
471438
WriteUninstaller "$INSTDIR\uninstall.exe"
472439
SectionEnd
473440

474-
Section "Webview2" SEC_WEBVIEW
475-
SectionIn RO
476-
# Read Only protects it from Installing when it is not needed
477-
478-
!insertmacro dlFile "${WV2URLType}" "webview2" "${WV2Version}" "${WV2DLURL}" "${WV2DLFileZip}"
479-
480-
DetailPrint "Installing webview2!"
481-
nsExec::ExecToLog '"${SLIMETEMP}\MicrosoftEdgeWebView2RuntimeInstaller.exe" /silent /install' $0
482-
Pop $0
483-
DetailPrint "Installing finished with $0."
484-
${If} $0 != 0
485-
Abort "Failed to install webview 2"
486-
${EndIf}
487-
488-
SectionEnd
489-
490441
Section "Java JRE" SEC_JRE
491442
SectionIn RO
492443

@@ -682,7 +633,7 @@ Section "-" SEC_REGISTERAPP
682633
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SlimeVR" \
683634
"UninstallString" '"$INSTDIR\uninstall.exe"'
684635
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SlimeVR" \
685-
"DisplayIcon" "$INSTDIR\slimevr.exe"
636+
"DisplayIcon" "$INSTDIR\SlimeVR.exe"
686637
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SlimeVR" \
687638
"HelpLink" "https://docs.slimevr.dev/"
688639
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SlimeVR" \
@@ -713,7 +664,6 @@ Function componentsPre
713664
${If} $SELECTED_INSTALLER_ACTION == "update"
714665
SectionSetFlags ${SEC_FIREWALL} ${SF_SELECTED}
715666
SectionSetFlags ${SEC_REGISTERAPP} 0
716-
SectionSetFlags ${SEC_WEBVIEW} ${SF_SELECTED}
717667
SectionSetFlags ${SEC_MSVCPP} ${SF_SELECTED}
718668
SectionSetFlags ${SEC_USBDRIVERS} ${SF_SECGRP}
719669
SectionSetFlags ${SEC_SERVER} ${SF_SELECTED}
@@ -738,18 +688,6 @@ Function componentsPre
738688
SectionSetFlags ${SEC_JRE} ${SF_USELECTED}
739689
${EndIf}
740690

741-
# Detect WebView2
742-
# https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#detect-if-a-suitable-webview2-runtime-is-already-installed
743-
# Trying to solve #41 Installer doesn't always install WebView2
744-
# Ignoring only user installed WebView2 it seems to make problems
745-
${If} ${RunningX64}
746-
ReadRegStr $0 HKLM "SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv"
747-
ReadRegStr $1 HKCU "Software\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv"
748-
${Else}
749-
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv"
750-
ReadRegStr $1 HKCU "Software\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv"
751-
${EndIf}
752-
753691
${If} $0 == ""
754692
${OrIf} $0 == "0.0.0.0"
755693
StrCpy $0 ""
@@ -764,12 +702,6 @@ Function componentsPre
764702
StrCpy $1 "1"
765703
${EndIf}
766704

767-
${If} $0 == ""
768-
${AndIf} $1 == ""
769-
SectionSetFlags ${SEC_WEBVIEW} ${SF_SELECTED}|${SF_RO}
770-
${Else}
771-
SectionSetFlags ${SEC_WEBVIEW} ${SF_USELECTED}
772-
${EndIf}
773705
FunctionEnd
774706

775707
Function .onSelChange
@@ -792,23 +724,9 @@ Section "-un.SlimeVR Server" un.SEC_SERVER
792724
Delete "$SMPROGRAMS\Uninstall SlimeVR Server.lnk"
793725
Delete "$SMPROGRAMS\SlimeVR Server.lnk"
794726
Delete "$DESKTOP\SlimeVR Server.lnk"
795-
Delete "$INSTDIR\slimevr-ui.exe"
796-
Delete "$INSTDIR\run.bat"
797-
Delete "$INSTDIR\run.ico"
798727
# Ignore errors on the files above, they are optional to remove and may not even exist
799728
ClearErrors
800-
Delete "$INSTDIR\slimevr*"
801-
Delete "$INSTDIR\MagnetoLib.dll"
802-
Delete "$INSTDIR\log*"
803-
Delete "$INSTDIR\*.log"
804-
Delete "$INSTDIR\*.lck"
805-
Delete "$INSTDIR\vrconfig.yml"
806-
Delete "$INSTDIR\LICENSE*"
807-
Delete "$INSTDIR\ThirdPartyNotices.txt"
808-
809-
RMDir /r "$INSTDIR\Recordings"
810-
RMdir /r "$INSTDIR\jre"
811-
RMDir /r "$INSTDIR\logs"
729+
RMDir /r $INSTDIR
812730

813731
IfErrors fail success
814732
fail:
@@ -854,7 +772,6 @@ SectionEnd
854772

855773
LangString DESC_SEC_SERVER ${LANG_ENGLISH} "Installs latest SlimeVR Server."
856774
LangString DESC_SEC_JRE ${LANG_ENGLISH} "Downloads and copies Java JRE 17 to installation folder. Required for SlimeVR Server."
857-
LangString DESC_SEC_WEBVIEW ${LANG_ENGLISH} "Downloads and install Webview2 if not already installed. Required for the SlimeVR GUI"
858775
LangString DESC_SEC_VRDRIVER ${LANG_ENGLISH} "Installs latest SteamVR Driver for SlimeVR."
859776
LangString DESC_SEC_USBDRIVERS ${LANG_ENGLISH} "A list of USB drivers that are used by various boards."
860777
LangString DESC_SEC_FEEDER_APP ${LANG_ENGLISH} "Installs SlimeVR Feeder App that sends position of SteamVR trackers (Vive trackers, controllers) to SlimeVR Server. Required for elbow tracking."
@@ -870,7 +787,6 @@ LangString DESC_PROCESS_ERROR ${LANG_ENGLISH} "An error happend while trying for
870787
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
871788
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_SERVER} $(DESC_SEC_SERVER)
872789
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_JRE} $(DESC_SEC_JRE)
873-
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_WEBVIEW} $(DESC_SEC_WEBVIEW)
874790
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_VRDRIVER} $(DESC_SEC_VRDRIVER)
875791
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_FEEDER_APP} $(DESC_SEC_FEEDER_APP)
876792
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_MSVCPP} $(DESC_SEC_MSVCPP)

0 commit comments

Comments
 (0)