#? stdtmpl(subsChar='?') | standard #proc generateNsisSetup(c: ConfigData): string = # result = "; NSIS script generated by niminst\n" & # "; To regenerate run ``niminst nsis`` or ``koch nsis``\n" ;-------------------------------- ; Included headers ; Modern User Interface 2.0 Header !include "MUI2.nsh" ; File Functions Header, used to get the current drive root. !include "FileFunc.nsh" ; *Patched* Environment Variable Manipulation Header, used to add ; tools to the user's PATH environment variable. !include "EnvVarUpdate.nsh" ;-------------------------------- ; Global variables and defines !define PRODUCT_NAME "?c.displayName" !define PRODUCT_VERSION "?c.version" !define PRODUCT_PUBLISHER "?c.authors" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\?{c.name}.exe" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_ROOT_KEY "HKCU" !define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir" ;-------------------------------- ; General Setup Information ; Name and output file Name "?{c.name} ?{c.version}" OutFile "?{c.name}_?{c.version}.exe" ; Default installation folder ; This is changed later (in .onInit) to the root directory, if possible. InstallDir "$PROGRAMFILES?{when sizeof(int) == 8: "64" else: ""}\?{c.name}-?{c.version}" ; Get installation folder from registry if available InstallDirRegKey HKCU "Software\c.name\c.version" "" ; Request user level application privileges. RequestExecutionLevel user ; Allow installation to the root drive directory. AllowRootDirInstall true ; Maximum compression! SetCompressor /SOLID /FINAL lzma ; Installer and Uninstaller Icons ; Icon "nim.ico" ; UninstallIcon "nim.ico" ; Set installation details to be shown by default ShowInstDetails show ShowUnInstDetails show ;-------------------------------- ; Interface Settings ; Warn the user if aborting during installation/uninstallation !define MUI_ABORTWARNING !define MUI_UNABORTWARNING ; Don't show a description for sections !define MUI_COMPONENTSPAGE_NODESC ;-------------------------------- ; Pages ; Setup the installer pages !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE "?{expandFilename(c.license)}" !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY ; Setup the start menu entry page var ICONS_GROUP !define MUI_STARTMENUPAGE_DEFAULTFOLDER "?{c.displayName}" !define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}" !define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}" !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}" !insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH ; Setup the uninstaller pages !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES ;-------------------------------- ;Languages !insertmacro MUI_LANGUAGE "English" ;-------------------------------- ;Installer Sections ; The core section. This is comprised of a base Nim installation, ; such as what would be retrieved via git, and an already bootstrapped ; Nim binary. Section "Core Files" CoreSection ; This is a mandotory section SectionIn RO ; Output files to the base installation directory SetOutPath "$INSTDIR" ; Only overwrite newer files SetOverwrite ifnewer
{.pragma: