I'm not seeing what it is you're trying to do, what nsh you are including.
I think you want to create custom pages, and with checkboxes or radio buttons or whatever, let the user choose some options. Those options would then control (enable / disable) Sections that do the actual installation and configuration to meet the user needs.
Here's an outline of the order your nsi should have:
use !define to create strings for registry keys, program name, etc so future updates are easier
include the nsh headers at the top of the file.
define the installer attributes (name, compressor, execution level, etc)
reserve files (if using solid compression)
define the pages (standard and custom)
define/code the sections
define the language strings (if you use MUI2) for section titles and subtitles
code callback functions .onInit, etc
code page functions (pre/show/leave)
code functions called from the sections
The nsis compiler is just one pass. Except for functions you call, nearly everything must have been compiled before you can write code that references it. Putting functions after all the sections allows the section ids to be defined, and should allow you to set or reset them even though at runtime the page leave code that has called the function was higher in the script than the sections.