# Maintainer Workflow
The goal of the [@NixOS/haskell](https://github.com/orgs/NixOS/teams/haskell)
team is to keep the Haskell packages in Nixpkgs up-to-date, while making sure
there are no Haskell-related evaluation errors or build errors that get into
the Nixpkgs `master` branch.
We do this by periodically merging an updated set of Haskell packages on the
`haskell-updates` branch into the `staging` branch. Each member of the team
takes a two week period where they are in charge of merging the
`haskell-updates` branch into `staging`. This is the documentation for this
workflow.
The workflow generally proceeds in three main steps:
1. create the initial `haskell-updates` PR, and update Stackage and Hackage snapshots
1. wait for contributors to fix newly broken Haskell packages
1. merge `haskell-updates` into `staging`
Each of these steps is described in a separate section.
There is a script that automates the workflow for merging the currently open
`haskell-updates` PR into `staging` and opening the next PR. It is described
at the end of this document.
## Initial `haskell-updates` PR
In this section we create the PR for merging `haskell-updates` into `staging`.
1. Make sure the `haskell-updates` branch is up-to-date with a _merge base_ of
`staging` and `master`. `haskell-updates` is not based _on_ `staging`,
so that it can share binary cache with `master`.
1. Update the Stackage Nightly resolver used by Nixpkgs and create a commit:
```console
$ ./maintainers/scripts/haskell/update-stackage.sh --do-commit
```
1. Update the Hackage package set used by Nixpkgs and create a commit:
```console
$ ./maintainers/scripts/haskell/update-hackage.sh --do-commit
```
1. Regenerate the Haskell package set used in Nixpkgs and create a commit:
```console
$ ./maintainers/scripts/haskell/regenerate-hackage-packages.sh --do-commit
```
1. Push these commits to the `haskell-updates` branch of the NixOS/nixpkgs repository.
1. Open a PR on Nixpkgs for merging `haskell-updates` into `staging`. The recommended
PR title and body text are described in the `merge-and-open-pr.sh` section.
## Notify Maintainers and Fix Broken Packages
After you've done the previous steps, Hydra will start building the new and
updated Haskell packages. You can see the progress Hydra is making at
https://hydra.nixos.org/jobset/nixpkgs/haskell-updates. This Hydra jobset is
defined in the file [release-haskell.nix](../../top-level/release-haskell.nix).
### Notify Maintainers
When Hydra finishes building all the updated packages for the `haskell-updates`
jobset, you should generate a build report to notify maintainers of their
newly broken packages. You can do that with the following commands:
```console
$ ./maintainers/scripts/haskell/hydra-report.hs get-report
$ ./maintainers/scripts/haskell/hydra-report.hs ping-maintainers
```
The `hydra-report.hs ping-maintainers` command generates a Markdown document
that you can paste in a GitHub comment on the PR opened above. This
comment describes which Haskell packages are now failing to build. It also
pings the maintainers so that they know to fix up their packages.
It may be helpful to pipe `hydra-report.hs ping-maintainers` into `xclip`
(XOrg) or `wl-copy` (Wayland) in order to post on GitHub.
This build report can be fetched and re-generated for new Hydra evaluations.
It may help contributors to try to keep the GitHub comment updated with the
most recent build report.
Maintainers should be given at least 7 days to fix up their packages when they
break. If maintainers don't fix up their packages within 7 days, then they
may be marked broken before merging `haskell-updates` into `staging`.
### Fix Broken Packages
After getting the build report, you can see which packages and Hydra jobs are
failing to build. The most important jobs are the
[`maintained`](https://hydra.nixos.org/job/nixpkgs/haskell-updates/maintained) and
[`mergeable`](https://hydra.nixos.org/job/nixpkgs/haskell-updates/mergeable)