4 The goal of the [@NixOS/haskell](https://github.com/orgs/NixOS/teams/haskell)
5 team is to keep the Haskell packages in Nixpkgs up-to-date, while making sure
6 there are no Haskell-related evaluation errors or build errors that get into
7 the Nixpkgs `master` branch.
9 We do this by periodically merging an updated set of Haskell packages on the
10 `haskell-updates` branch into the `master` branch. Each member of the team
11 takes a two week period where they are in charge of merging the
12 `haskell-updates` branch into `master`. This is the documentation for this
15 The workflow generally proceeds in three main steps:
17 1. create the initial `haskell-updates` PR, and update Stackage and Hackage snapshots
18 1. wait for contributors to fix newly broken Haskell packages
19 1. merge `haskell-updates` into `master`
21 Each of these steps is described in a separate section.
23 There is a script that automates the workflow for merging the currently open
24 `haskell-updates` PR into `master` and opening the next PR. It is described
25 at the end of this document.
27 ## Initial `haskell-updates` PR
29 In this section we create the PR for merging `haskell-updates` into `master`.
31 1. Make sure the `haskell-updates` branch is up-to-date with `master`.
33 1. Update the Stackage Nightly resolver used by Nixpkgs and create a commit:
36 $ ./maintainers/scripts/haskell/update-stackage.sh --do-commit
39 1. Update the Hackage package set used by Nixpkgs and create a commit:
42 $ ./maintainers/scripts/haskell/update-hackage.sh --do-commit
45 1. Regenerate the Haskell package set used in Nixpkgs and create a commit:
48 $ ./maintainers/scripts/haskell/regenerate-hackage-packages.sh --do-commit
51 1. Push these commits to the `haskell-updates` branch of the NixOS/nixpkgs repository.
53 1. Open a PR on Nixpkgs for merging `haskell-updates` into `master`. The recommended
54 PR title and body text are described in the `merge-and-open-pr.sh` section.
56 ## Notify Maintainers and Fix Broken Packages
58 After you've done the previous steps, Hydra will start building the new and
59 updated Haskell packages. You can see the progress Hydra is making at
60 https://hydra.nixos.org/jobset/nixpkgs/haskell-updates. This Hydra jobset is
61 defined in the file [release-haskell.nix](../../top-level/release-haskell.nix).
63 ### Notify Maintainers
65 When Hydra finishes building all the updated packages for the `haskell-updates`
66 jobset, you should generate a build report to notify maintainers of their
67 newly broken packages. You can do that with the following commands:
70 $ ./maintainers/scripts/haskell/hydra-report.hs get-report
71 $ ./maintainers/scripts/haskell/hydra-report.hs ping-maintainers
74 The `hydra-report.hs ping-maintainers` command generates a Markdown document
75 that you can paste in a GitHub comment on the PR opened above. This
76 comment describes which Haskell packages are now failing to build. It also
77 pings the maintainers so that they know to fix up their packages.
79 It may be helpful to pipe `hydra-report.hs ping-maintainers` into `xclip`
80 (XOrg) or `wl-copy` (Wayland) in order to post on GitHub.
82 This build report can be fetched and re-generated for new Hydra evaluations.
83 It may help contributors to try to keep the GitHub comment updated with the
84 most recent build report.
86 Maintainers should be given at least 7 days to fix up their packages when they
87 break. If maintainers don't fix up their packages within 7 days, then they
88 may be marked broken before merging `haskell-updates` into `master`.
90 ### Fix Broken Packages
92 After getting the build report, you can see which packages and Hydra jobs are
93 failing to build. The most important jobs are the
94 [`maintained`](https://hydra.nixos.org/job/nixpkgs/haskell-updates/maintained) and
95 [`mergeable`](https://hydra.nixos.org/job/nixpkgs/haskell-updates/mergeable)
96 jobs. These are both defined in
97 [`release-haskell.nix`](../../top-level/release-haskell.nix).
99 `mergeable` is a set of the most important Haskell packages, including things
100 like Pandoc and XMonad. These packages are widely used. We would like to
101 always keep these building.
103 `maintained` is a set of Haskell packages that have maintainers in Nixpkgs.
104 We should be proactive in working with maintainers to keep their packages
107 Steps to fix Haskell packages that are failing to build is out of scope for
108 this document, but it usually requires fixing up dependencies that are now
111 ### Mark Broken Packages
113 Packages that do not get fixed can be marked broken with the following
114 commands. First check which packages are broken:
117 $ ./maintainers/scripts/haskell/hydra-report.hs get-report
118 $ ./maintainers/scripts/haskell/hydra-report.hs mark-broken-list
121 This shows a list of packages that reported a build failure on `x86_64-linux` on Hydra.
123 Next, run the following command:
126 $ ./maintainers/scripts/haskell/mark-broken.sh --do-commit
129 This first opens up an editor with the broken package list. Some of these
130 packages may have a maintainer in Nixpkgs. If these maintainers have not been
131 given 7 days to fix up their package, then make sure to remove those packages
132 from the list before continuing. After saving and exiting the editor, the
133 following will happen:
135 - Packages from the list will be added to
136 [`configuration-hackage2nix/broken.yaml`](configuration-hackage2nix/broken.yaml).
137 This is a list of Haskell packages that are known to be broken.
139 - [`hackage-packages.nix`](hackage-packages.nix) will be regenerated. This
140 will mark all Haskell packages in `configuration-hackage2nix/broken.yaml`
144 [`configuration-hackage2nix/transitive-broken.yaml`](configuration-hackage2nix/transitive-broken.yaml)
145 file will be updated. This is a list of Haskell packages that
146 depend on a package in `configuration-hackage2nix/broken.yaml` or
147 `configuration-hackage2nix/transitive-broken.yaml`
149 - `hackage-packages.nix` will be regenerated again. This will set
150 `hydraPlatforms = none` for all the packages in
151 `configuration-hackage2nix/transitive-broken.yaml`. This makes
152 sure that Hydra does not try to build any of these packages.
154 - All updated files will be committed.
156 ## Merge `haskell-updates` into `master`
158 Now it is time to merge the `haskell-updates` PR you opened above.
160 Before doing this, make sure of the following:
162 - All Haskell packages that fail to build are correctly marked broken or
165 - The `maintained` and `mergeable` jobs are passing on Hydra.
167 - The maintainers for any maintained Haskell packages that are newly broken
168 have been pinged on GitHub and given at least a week to fix their packages.
169 This is especially important for widely-used packages like `cachix`.
171 - Make sure you first merge the `master` branch into `haskell-updates`. Wait
172 for Hydra to evaluate the new `haskell-updates` jobset. Make sure you only
173 merge `haskell-updates` into `master` when there are no evaluation errors.
175 - Due to Hydra having only a small number of Darwin build machines, the
176 `haskell-updates` jobset on Hydra often has many queued Darwin jobs.
177 In order to not have these queued Darwin jobs prevent the `haskell-updates`
178 branch from being merged to `master` in a timely manner, we have special
179 rules for Darwin jobs.
181 - It is alright to merge the `haskell-updates` branch to `master` if
182 there are remaining queued Darwin jobs on Hydra.
184 - We would like to keep GHC and the `mergeable` job building on Darwin.
185 Do not merge the `haskell-updates` branch to `master` if GHC is failing
186 to build, or the `mergeable` job has failing Darwin constituent jobs.
188 If GHC and the `mergeable` job are not failing, but merely queued,
189 it is alright to merge the `haskell-updates` branch to `master`.
191 - We do not need to keep the `maintained` job building on Darwin.
192 If `maintained` packages are failing on Darwin, it is helpful to
193 mark them as broken on that platform.
195 When you've double-checked these points, go ahead and merge the `haskell-updates` PR.
196 After merging, **make sure not to delete the `haskell-updates` branch**, since it
197 causes all currently open Haskell-related pull-requests to be automatically closed on GitHub.
199 ## Script for Merging `haskell-updates` and Opening a New PR
201 There is a script that automates merging the current `haskell-updates` PR and
202 opening the next one. When you want to merge the currently open
203 `haskell-updates` PR, you can run the script with the following steps:
205 1. Make sure you have previously authenticated with the `gh` command. The
206 script uses the `gh` command to merge the current PR and open a new one.
207 You should only need to do this once.
209 This command can be used to authenticate:
215 This command can be used to confirm that you have already authenticated:
221 1. Make sure you have setup your `~/.cabal/config` file for authentication
222 for uploading the NixOS package versions to Hackage. See the following
223 section for details on how to do this.
225 1. Make sure you have correctly marked packages broken. One of the previous
226 sections explains how to do this.
231 $ ./maintainers/scripts/haskell/hydra-report.hs get-report
232 $ ./maintainers/scripts/haskell/hydra-report.hs mark-broken-list
233 $ ./maintainers/scripts/haskell/mark-broken.sh --do-commit
236 1. Merge `master` into `haskell-updates` and make sure to push to the
237 `haskell-updates` branch. (This can be skipped if `master` has recently
238 been merged into `haskell-updates`.)
240 1. Go to https://hydra.nixos.org/jobset/nixpkgs/haskell-updates and force an
241 evaluation of the `haskell-updates` jobset. See one of the following
242 sections for how to do this. Make sure there are no evaluation errors. If
243 there are remaining evaluation errors, fix them before continuing with this
246 1. Run the script to merge `haskell-updates`:
249 $ ./maintainers/scripts/haskell/merge-and-open-pr.sh PR_NUM_OF_CURRENT_HASKELL_UPDATES_PR
252 Find the PR number easily [here](https://github.com/nixos/nixpkgs/pulls?q=is%3Apr+is%3Aopen+head%3Ahaskell-updates)
254 This does the following things:
256 1. Fetches `origin`, makes sure you currently have the `haskell-updates`
257 branch checked out, and makes sure your currently checked-out
258 `haskell-updates` branch is on the same commit as
259 `origin/haskell-updates`.
261 1. Merges the currently open `haskell-updates` PR.
263 1. Updates the version of Haskell packages in NixOS on Hackage.
265 1. Updates Stackage and Hackage snapshots. Regenerates the Haskell package set.
267 1. Pushes the commits updating Stackage and Hackage and opens a new
268 `haskell-updates` PR on Nixpkgs. If you'd like to do this by hand,
269 look in the script for the recommended PR title and body text.
271 ## Update Hackage Version Information
273 After merging into `master` you can update what Hackage displays as the current
274 version in NixOS for every individual package. To do this you run
275 `maintainers/scripts/haskell/upload-nixos-package-list-to-hackage.sh`. See the
276 script for how to provide credentials. Once you have configured credentials,
277 running this takes only a few seconds.
281 Here are some additional tips that didn't fit in above.
283 - Hydra tries to evaluate the `haskell-updates` branch (in the
284 [`nixpkgs:haskell-updates`](https://hydra.nixos.org/jobset/nixpkgs/haskell-updates)
285 jobset) every 4 hours. It is possible to force a new Hydra evaluation without
286 waiting 4 hours by the following steps:
288 1. Log into Hydra with your GitHub or Google account.
289 1. Go to the [nixpkgs:haskell-updates](https://hydra.nixos.org/jobset/nixpkgs/haskell-updates) jobset.
290 1. Click the `Actions` button.
291 1. Select `Evaluate this jobset`.
292 1. If you refresh the page, there should be a new `Evaluation running since:` line.
293 1. Evaluations take about 10 minutes to finish.
295 - It is sometimes helpful to update the version of
296 [`cabal2nix` / `hackage2nix`](https://github.com/NixOS/cabal2nix) that our
297 maintainer scripts use. This can be done with the
298 [`maintainers/scripts/haskell/update-cabal2nix-unstable.sh`](../../../maintainers/scripts/haskell/update-cabal2nix-unstable.sh)
301 You might want to do this if a user contributes a fix to `cabal2nix` that
302 will immediately fix a Haskell package in Nixpkgs. First, merge in
303 the PR to `cabal2nix`, then run `update-cabal2nix-upstable.sh`. Finally, run
304 [`regenerate-hackage-packages.sh`](../../../maintainers/scripts/haskell/regenerate-hackage-packages.sh)
305 to regenerate the Hackage package set with the updated version of `hackage2nix`.
307 - Make sure never to update the Hackage package hashes in
308 [`pkgs/data/misc/hackage/`](../../../pkgs/data/misc/hackage/), or the
309 pinned Stackage Nightly versions on the release branches (like
313 [`update-hackage.sh`](../../../maintainers/scripts/haskell/update-hackage.sh)
315 [`update-stackage.sh`](../../../maintainers/scripts/haskell/update-stackage.sh)
316 scripts should never be used on the release branches.
318 However, changing other files in `./.` and regenerating the package set is encouraged.
319 This can be done with
320 [`regenerate-hackage-packages.sh`](../../../maintainers/scripts/haskell/regenerate-hackage-packages.sh)
323 - The Haskell team members generally hang out in the Matrix room
324 [#haskell:nixos.org](https://matrix.to/#/#haskell:nixos.org).
326 - This is a checklist for things that need to happen when a new
327 member is added to the Nixpkgs Haskell team.
329 1. Add the person to the
330 [@NixOS/haskell](https://github.com/orgs/NixOS/teams/haskell)
331 team. You may need to ask someone in the NixOS organization
332 to do this, like [@domenkozar](https://github.com/domenkozar).
333 This gives the new member access to the GitHub repos like
334 [cabal2nix](https://github.com/NixOS/cabal2nix).
336 1. Add the person as a maintainer for the following packages
338 - https://hackage.haskell.org/package/cabal2nix
339 - https://hackage.haskell.org/package/distribution-nixpkgs
340 - https://hackage.haskell.org/package/hackage-db
341 - https://hackage.haskell.org/package/jailbreak-cabal
342 - https://hackage.haskell.org/package/language-nix
344 1. Add the person to the `haskell` team in
345 [`maintainers/team-list.nix`](../../../maintainers/team-list.nix).
346 This team is responsible for some important packages in
347 [release-haskell.nix](../../top-level/release-haskell.nix).
350 [Nextcloud Calendar](https://cloud.maralorn.de/apps/calendar/p/H6migHmKX7xHoTFa)
351 and work the new member into the `haskell-updates` rotation.
353 1. Optionally, have the new member add themselves to the Haskell
354 section in [`CODEOWNERS`](../../../.github/CODEOWNERS). This
355 will cause them to get pinged on most Haskell-related PRs.