Posted on January 19, 2018 by Dmitry Bushev

Stackage nixpkgs Overlays

Nixpkgs overlay with Stackage LTS releases

Yesterday we published a typeable/nixpkgs-stackage Stackage Nixpkgs overlay plus a typeable/stackage2nix update with overlay support.

Here’s a quick overview of new features.

You can find more about stackage2nix in our previous blog post.

Stackage nixpkgs overlays

Overlay adds Stackage LTS releases to Nixpkgs at the pkgs.haskell.packages.stackage.

You can use these Stackage packages the same way as original Hackage packages maintained by Nix. Below you will find some examples from Nixpkgs Haskell manual with haskellPackages replaced with LTS packages.

List packages in lts-10.0 release:

nix-env -f "<nixpkgs>" -qaP -A haskell.packages.stackage.lts-100

Create a development environment from LTS package set:

nix-shell -p "haskell.packages.stackage.lts-100.ghcWithPackages (pkgs: [pkgs.mtl])"

Override and enable profiling:

with import <nixpkgs> {};
haskell.packages.stackage.lts-100.override {
  overrides = self: super: {
    mkDerivation = args: super.mkDerivation (args // {
      enableLibraryProfiling = true;

Stackage packages are generated with stackage2nix and will be updated on a regular basis.

stackage2nix build support

Overlay also adds build utils at pkgs.haskell.packages.stackage.lib. You can create a build derivation from your project’s stack.yaml using callStackage2nix helper function.

{ nixpkgs ? import <nixpkgs> {} }:

nixpkgs.haskell.packages.stackage.lib.callStackage2nix "my-package" ./. {
  inherit nixpkgs;

More complex example with pinned Nixpkgs, stackage2nix source pulled from GitHub, and overriding of the resulting Haskell packages:

  nixpkgs = import ./nixpkgs-pinned.nix {};
  inherit (nixpkgs) pkgs lib haskell;

  stackage2nixSrc = pkgs.fetchFromGitHub (lib.importJSON ./stackage2nix.json);

  stackagePackages = haskell.packages.stackage.lib.callStackage2nix "stackage2nix" stackage2nixSrc { inherit nixpkgs; };
  stackage = stackagePackages.override {
    overrides = self: super: {
      stackage2nix = haskell.lib.disableSharedExecutables super.stackage2nix;

callStackage2nix function calls stackage2nix on provided path and produces a derivation with Haskell packages for the project. nixpkgs-stackage/examples directory contains full source code of the derivations listed above.


stackage2nix was also updated to support the Stackage overlay. Now the default is to create a single default.nix with an override of existing Stackage packages. The advantage of this approach is that it does not require additional --all-cabal-hashes and --lts-haskell flags (they are only needed for Stackage generation). But it is required to have typeable/nixpkgs-stackage overlay installed in the system.

To enable the old behavior and generate all packages required for the build, pass --with-stackage or --with-stackage-closure flags.


You may also like

Want to know more?
Get in touch with us!
Contact Us

Privacy policy

Last updated: 1 September 2021

Typeable OU ("us", "we", or "our") operates (the "Site"). This page informs you of our policies regarding the collection, use and disclosure of Personal Information we receive from users of the Site.

We use your Personal Information only for providing and improving the Site. By using the Site, you agree to the collection and use of information in accordance with this policy.

Information Collection And Use

While using our Site, we may ask you to provide us with certain personally identifiable information that can be used to contact or identify you. Personally identifiable information may include, but is not limited to your name ("Personal Information").

Log Data

Like many site operators, we collect information that your browser sends whenever you visit our Site ("Log Data").

This Log Data may include information such as your computer's Internet Protocol ("IP") address, browser type, browser version, the pages of our Site that you visit, the time and date of your visit, the time spent on those pages and other statistics.

In addition, we may use third party services such as Google Analytics that collect, monitor and analyze this ...


Cookies are files with small amount of data, which may include an anonymous unique identifier. Cookies are sent to your browser from a web site and stored on your computer's hard drive.

Like many sites, we use "cookies" to collect information. You can instruct your browser to refuse all cookies or to indicate when a cookie is being sent. However, if you do not accept cookies, you may not be able to use some portions of our Site.


The security of your Personal Information is important to us, so we don't store any personal information and use third-party GDPR-compliant services to store contact data supplied with a "Contact Us" form and job applications data, suplied via "Careers" page.

Changes To This Privacy Policy

This Privacy Policy is effective as of @@privacePolicyDate​ and will remain in effect except with respect to any changes in its provisions in the future, which will be in effect immediately after being posted on this page.

We reserve the right to update or change our Privacy Policy at any time and you should check this Privacy Policy periodically. Your continued use of the Service after we post any modifications to the Privacy Policy on this page will constitute your acknowledgment of the modifications and your consent to abide and be bound by the modified Privacy Policy.

If we make any material changes to this Privacy Policy, we will notify you either through the email address you have provided us, or by placing a prominent notice on our website.

Contact Us

If you have any questions about this Privacy Policy, please contact us.