There's a script that I've done which may help you, here's a snippet:
OutFile "test.exe"
ShowInstDetails show
InstallDir "$PROGRAMFILES\My Application"
Page components
page directory
page instfiles
!include "Sections.nsh"
!include "logiclib.nsh"
Section /o "Install NSIS plugin" sec1
DetailPrint "Installing NSIS plugin (sec1)"
SectionEnd
Section /o "Install Firefox plugin" sec2
DetailPrint "Installing Firefox plugin (sec2)"
SectionEnd
Function .onSelChange
!insertmacro StartRadioButtons $1
!insertmacro RadioButton ${sec1}
!insertmacro RadioButton ${sec2}
!insertmacro EndRadioButtons
SectionGetFlags ${sec1} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
${If} $R0 = ${SF_SELECTED}
ReadRegStr $R0 HKLM "Software\NSIS" ""
StrCpy $INSTDIR "$R0\Plugins\My Plugin"
${EndIf}
SectionGetFlags ${sec2} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
${If} $R0 = ${SF_SELECTED}
ReadRegStr $R0 HKLM "Software\Mozilla\Mozilla Firefox" "CurrentVersion"
ReadRegStr $R0 HKLM "Software\Mozilla\Mozilla Firefox\$R0\Main" "Install Directory"
StrCpy $INSTDIR "$R0\Plugins\My Plugin"
${EndIf}
FunctionEnd