hsinstall: Install Haskell software

[ library, program, utility ] [ Propose Tags ]

This is a tool for deploying software projects into directory structures suitable for installation on a system. It builds upon the `stack install` command and adds more features. It's also a tool for easier AppImage creation.

[Skip to Readme]
Versions [faq] 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1, 2.2, 2.5, 2.6
Change log changelog.md
Dependencies ansi-wl-pprint, base (>=4.8 && <5.0), Cabal, directory, filepath, heredoc, hsinstall, optparse-applicative, process, safe-exceptions, transformers [details]
License ISC
Copyright 2016-2020 Dino Morelli
Author Dino Morelli
Maintainer Dino Morelli <dino@ui3.info>
Category Utility
Home page https://github.com/dino-/hsinstall#readme
Bug tracker https://github.com/dino-/hsinstall/issues
Source repo head: git clone https://github.com/dino-/hsinstall
Uploaded by DinoMorelli at 2020-01-12T21:45:57Z
Distributions LTSHaskell:2.2, NixOS:2.6, Stackage:2.2
Executables hsinstall
Downloads 5643 total (155 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2020-01-13 [all 1 reports]


[Index] [Quick Jump]


Maintainer's Corner

For package maintainers and hackage trustees

Readme for hsinstall-2.6

[back to package description]



Pack a haskell project into a deployable directory structure



hsinstall is a tool for installing a Haskell software project into a directory structure for deployment. It builds upon the stack install command and adds these features:

  • Copies the LICENSE file into <PREFIX>/share/<PROJECT-NAME>/doc
  • Copies the contents of a static directory stucture in your project (named hsinstall) into the destination prefix directory. This can contain additional binaries or scripts, resources, documentation, etc. (more on this later in TEMPLATE DIRECTORY)
  • Optionally builds an AppDir directory structure for the project and produces an AppImage binary

To use hsinstall, it will be necessary to have the Haskell stack tool on your PATH: https://docs.haskellstack.org/en/stable/README/

If the AppImage features are desired, you must have these tools on your PATH: linuxdeploy: https://github.com/linuxdeploy/linuxdeploy/releases, linuxdeploy-plugin-appimage: https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases

Running hsinstall on a project for the first time and with no arguments will produce this in . :

    bin/  <-- All binaries in the project

The -p,--prefix switch allows you to set a prefix other than AppDir/usr. This could be anywhere, like myproject-2.3 or /usr/local or /opt

In addition, if an hsinstall directory exists, its contents will be copied into the prefix before build and install. See TEMPLATE DIRECTORY below for more info on this.


The -i,--mk-appimage switch will change the default prefix to EXE.AppDir/usr and only the specified EXE will be installed into <PREFIX>/bin, AppImages are intended to be made for exactly one binary.

If .desktop and .svg files are not found in the hsinstall directory, defaults will be created for you and placed in the correct subdirs. Check these files into source control for future builds.

The default .desktop file Categories will be populated with 'Utility;'. We recommend adjusting this using the XDG list of registered categories: https://specifications.freedesktop.org/menu-spec/latest/apa.html

If your application is a command-line program, append a line containing this to the end of the default .desktop file: 'Terminal=true'

If your application isn't a command-line program, we recommend using a proper icon instead of the hsinstall default, which is a command shell icon.

For more info on AppImage: https://appimage.org/


If present, hsinstall will copy the contents of the hsinstall template directory into <PREFIX>. Here's an explanation of the hsinstall directory contents:

  bin/  <-- Put additional binaries and scripts to be deployed here
    applications/  <-- Only for AppImage
      <EXE>.desktop  <-- Will be generated by first-time AppImage creation attempt
    <PROJECT-NAME>/  <-- Only needed if you have resources
      resources/  <-- Put data files your software will need at runtime here
    icons/  <-- Only for AppImage
            <EXE>.svg  <-- Will be generated by first-time AppImage creation attempt

In order to locate data files at runtime, including resources, the hsinstall project includes a library to construct the share path relative to the executable. See this source code for help with integrating this into your app.


Browse the source

Get source with git and build

$ git clone https://github.com/dino-/hsinstall.git
$ cd hsinstall
$ stack build
$ stack haddock --no-haddock-deps hsinstall

If you have the abovementioned linuxdeploy-* programs on your path, we can do something really cool. Use this freshly-built hsinstall to package itself into an AppImage:

$ stack exec hsinstall -- --mk-appimage hsinstall

And you should see an hsinstall-y.z-x86_64.AppImage binary in .

Tip: Use git clean -df to blow away untracked things like the AppDir and AppImage artifacts.



Dino Morelli dino@ui3.info