HORIZON HASKELLDocsSearch packagesCtrl K
Theme: |

9 sites

FAQ

What is a stable package set?

A stable package set is a collection of package versions that all build together. A package repository such as Hackage hosts every available version of a package. A stable package set picks one version of each and supplies them as a single unit known to work together, so you can start a project without resolving dependency conflicts.

How is this different from Stackage?

Stackage is also a stable package set, with nightly and lts snapshots that build together. Stackage is made for the stack build tool. Horizon is made for Nix alone. Horizon package sets can be self-hosted, kept private, and versioned apart from the projects that use them, which means:

  • one package set can be reused across many repositories;
  • the latest versions are the head of the set's branch;
  • a problem can be bisected in the set itself and in the projects that use it.

How do I use it?

Use a set as a flake input and build against its legacyPackages. The QuickStart has a complete flake.nix.

Which package sets are there?

  • horizon-core: the libraries the horizon toolchain uses to generate package sets.
  • horizon-advance: canary testing libraries for new GHC versions.
  • horizon-platform: a large collection of the most common Haskell libraries used in production.
  • horizon-web3: blockchain clients and SDKs, for Solana and Cardano.
  • horizon-javascript: the libraries that build for GHC's JavaScript backend, for front ends that run in the browser.
  • horizon-build-essentials: everything cabal-install needs to build on the Horizon toolchain.

Each set's page lists its branches, the GHC each builds with and its packages. The sets' repositories are under package-sets/haskell on NixLab.

Does this use nixpkgs?

Yes. Horizon builds its package sets with nixpkgs' Haskell library functions, so every Horizon set has the same interface as nixpkgs' haskellPackages: callCabal2nix, shellFor, ghcWithPackages, extend and the rest work as they do there.

Does this use haskell.nix?

No. The sets are plain Nix and rely neither on Stackage nor on cabal's constraint solver.

Can I have my own package set?

Yes. A package set is a horizon.vx file that horizon-config turns into Nix. A set builds on a Horizon set's compiler and tools, provides the packages you list, and can be hosted anywhere you keep a git repository.

For example, this set builds on horizon-platform's toolchain and provides acme-missiles from Hackage. In an empty directory, write horizon.vx:

do
  name "my-set"
  on (toolchain (forge "nixlab.openfp.net/package-sets/haskell/horizon-platform") (branch "refs/tags/snapshots/lts/ghc-10.0.x/9"))
  flake Generated
  hackage "acme-missiles" "0.3"
  root "acme-missiles"

Then generate the set and build the package you added:

git init
git add -A
nix run 'git+https://nixlab.openfp.net/horizon/horizon-config-shell?ref=refs/tags/0.24.0' -- update horizon.vx
git add -A
nix flake lock
git add flake.lock
nix build .#acme-missiles

flake Generated lets horizon-config write the set's flake.nix. Commit it with flake.lock and the other generated files, and do not edit it. To write flake.nix yourself, for example to add outputs, use flake Manual; Configuration, under "Who owns flake.nix", shows the flake it needs.

root names a package the set exists to provide: its assurances check, run by nix flake check, fails unless every root is in the set. The set holds the packages its roots need, built with horizon-platform's compiler and build tools; list each package you want with hackage, git or local. horizon-platform's own horizon.vx shows a full set, with patches and version exceptions.