2# Build a specific package from Hackage or Stackage
4## From a [Stackage][] snapshot
6To build a package, say [lens][], from a Stackage snapshot, say
7[lts-13.28][], you could run:
9nix build '(with import <nixpkgs> (import (builtins.fetchTarball "https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz") {}).nixpkgsArgs; haskell-nix.snapshots."lts-13.28").lens.components.library'
11This would build the (public) library component of the [lens][] package as
12fixed by the [lts-13.28][] stackage snapshot. Nightly snapshots like
13`nightly-2020-06-21` are also available.
15## A specific version from Hackage
17To build any package from hackage, say [lens][], at any version, say 4.17.1,
20nix build '(with import <nixpkgs> (import (builtins.fetchTarball "https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz") {}).nixpkgsArgs; (haskell-nix.hackage-package { name = "lens"; version = "4.17.1"; compiler-nix-name = "ghc8102"; })).components.library'
22This would build the (public) library component of the [lens-4.17.1][] package
25### Pinning hackage index
27The dependencies would be resolved against the most recent
28[hackage-index-state][] which comes with your [haskell.nix][] checkout via the
29[hackage.nix][] pin. A specific one can be specified as well:
31nix build '(with import <nixpkgs> (import (builtins.fetchTarball "https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz") {}).nixpkgsArgs; (haskell-nix.hackage-package { name = "lens"; version = "4.17.1"; compiler-nix-name = "ghc8102"; index-state = "2019-07-14T00:00:00Z"; })).components.library'
33This would use the hackage index as of `2019-07-14T00:00:00Z` to produce a
34build plan for the [lens-4.17.1][] package.
36[Stackage]: https://stackage.org
37[Hackage]: https://hackage.haskell.org
38[hackage.nix]: https://github.com/input-output-hk/hackage.nix
39[haskell.nix]: https://github.com/input-output-hk/haskell.nix
40[lts-13.28]: https://www.stackage.org/lts-13.28
41[lens]: https://hackage.haskell.org/package/lens
42[lens-4.17.1]: https://hackage.haskell.org/package/lens-4.17.1
43[hackage-index-state]: https://github.com/input-output-hk/hackage.nix/blob/master/index-state-hashes.nix
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list