This library makes it easier to write NSIS Windows Installers. You should use this library if:
The original NSIS tool requires you to write a script in a custom programming language. This library lets you write a Haskell program using special functions that generates an NSIS script. Using this library is better because:
If your script is simple it is likely to look relatively similar in either system. If your script is complex it could end up 100 lines shorter and far clearer in my system. As an illustrative example, let's warn before installing into the Windows directory or the System directory. In original NSIS this would be:
StrCmp $WINDIR $INSTDIR bad 0
StrCmp $SYSDIR $INSTDIR bad 0
Goto skip
bad:
MessageBox MBOK|MB_ICON_EXCLAMATION "Warning: installing into the Windows directory"
skip:
Using this library we can write:
iff_ ("$INSTDIR" %== "$WINDIR" %|| "$INSTDIR" %== "$SYSDIR") $
alert "Warning: installing into the Windows directory"
The Examples directory contains a number of simple NSIS scripts, several ported from the NSIS distributed examples. As a simple example:
import Development.NSIS
main = writeFile "example1.nsi" $ nsis $ do
name "Example1" -- The name of the installer
outFile "example1.exe" -- Where to produce the installer
installDir "$DESKTOP/Example1" -- The default installation directory
requestExecutionLevel User -- Request application privileges for Windows Vista
-- Pages to display
page Directory -- Pick where to install
page InstFiles -- Give a progress bar while installing
-- Groups fo files to install
section "" [] $ do
setOutPath "$INSTDIR" -- Where to install files in this section
file [] "Example1.hs" -- File to put into this section
Running this code will generate a file example1.nsi
that can be processed with makensis
to produce the installer example1.exe
. Documentation on each of the functions is available here.
I welcome contributions. Some things you could help with:
I have written this library to address my needs. I would welcome bug reports or pull requests, in particular if you can write the installer you need in NSIS but not in this library.