···1+#! /usr/bin/env nix-shell
2+#! nix-shell -i bash -p git gh -I nixpkgs=.
3+#
4+# Script to merge the currently open haskell-updates PR into master, bump the
5+# Stackage version and Hackage versions, and open the next haskell-updates PR.
6+7+set -eu -o pipefail
8+9+# exit after printing first argument to this function
10+function die {
11+ # echo the first argument
12+ echo "ERROR: $1"
13+ echo "Aborting!"
14+15+ exit 1
16+}
17+18+function help {
19+ echo "Usage: $0 HASKELL_UPDATES_PR_NUM"
20+ echo "Merge the currently open haskell-updates PR into master, and open the next one."
21+ echo
22+ echo " -h, --help print this help"
23+ echo " HASKELL_UPDATES_PR_NUM number of the currently open PR on NixOS/nixpkgs"
24+ echo " for the haskell-updates branch"
25+ echo
26+ echo "Example:"
27+ echo " \$ $0 137340"
28+29+ exit 1
30+}
31+32+# Read in the current haskell-updates PR number from the command line.
33+while [[ $# -gt 0 ]]; do
34+ key="$1"
35+36+ case $key in
37+ -h|--help)
38+ help
39+ ;;
40+ *)
41+ curr_haskell_updates_pr_num="$1"
42+ shift
43+ ;;
44+ esac
45+done
46+47+if [[ -z "${curr_haskell_updates_pr_num-}" ]] ; then
48+ die "You must pass the current haskell-updates PR number as the first argument to this script."
49+fi
50+51+# Make sure you have gh authentication setup.
52+if ! gh auth status 2>/dev/null ; then
53+ die "You must setup the \`gh\` command. Run \`gh auth login\`."
54+fi
55+56+# Fetch nixpkgs to get an up-to-date origin/haskell-updates branch.
57+echo "Fetching origin..."
58+git fetch origin >/dev/null
59+60+# Make sure we are currently on a local haskell-updates branch.
61+curr_branch="$(git rev-parse --abbrev-ref HEAD)"
62+if [[ "$curr_branch" != "haskell-updates" ]]; then
63+ die "Current branch is not called \"haskell-updates\"."
64+fi
65+66+# Make sure our local haskell-updates branch is on the same commit as
67+# origin/haskell-updates.
68+curr_branch_commit="$(git rev-parse haskell-updates)"
69+origin_haskell_updates_commit="$(git rev-parse origin/haskell-updates)"
70+if [[ "$curr_branch_commit" != "$origin_haskell_updates_commit" ]]; then
71+ die "Current branch is not at the same commit as origin/haskell-updates"
72+fi
73+74+# Merge the current open haskell-updates PR.
75+echo "Merging https://github.com/NixOS/nixpkgs/pull/${curr_haskell_updates_pr_num}..."
76+gh pr merge --repo NixOS/nixpkgs --merge "$curr_haskell_updates_pr_num"
77+78+# Update stackage, Hackage hashes, and regenerate Haskell package set
79+echo "Updating Stackage..."
80+./maintainers/scripts/haskell/update-stackage.sh --do-commit
81+echo "Updating Hackage hashes..."
82+./maintainers/scripts/haskell/update-hackage.sh --do-commit
83+echo "Regenerating Hackage packages..."
84+./maintainers/scripts/haskell/regenerate-hackage-packages.sh --do-commit
85+86+# Push these new commits to the haskell-updates branch
87+echo "Pushing commits just created to the haskell-updates branch"
88+git push
89+90+# Open new PR
91+new_pr_body=$(cat <<EOF
92+### This Merge
93+94+This PR is the regular merge of the \`haskell-updates\` branch into \`master\`.
95+96+This branch is being continually built and tested by hydra at https://hydra.nixos.org/jobset/nixpkgs/haskell-updates.
97+98+We roughly aim to merge these \`haskell-updates\` PRs at least once every two weeks. See the @NixOS/haskell [team calendar](https://cloud.maralorn.de/apps/calendar/p/Mw5WLnzsP7fC4Zky) for who is currently in charge of this branch.
99+100+### haskellPackages Workflow Summary
101+102+Our workflow is currently described in [\`pkgs/development/haskell-modules/HACKING.md\`](https://github.com/NixOS/nixpkgs/blob/haskell-updates/pkgs/development/haskell-modules/HACKING.md).
103+104+The short version is this:
105+* We regularly update the Stackage and Hackage pins on \`haskell-updates\` (normally at the beginning of a merge window).
106+* The community fixes builds of Haskell packages on that branch.
107+* We aim at at least one merge of \`haskell-updates\` into \`master\` every two weeks.
108+* We only do the merge if the [\`mergeable\`](https://hydra.nixos.org/job/nixpkgs/haskell-updates/mergeable) job is succeeding on hydra.
109+* If a [\`maintained\`](https://hydra.nixos.org/job/nixpkgs/haskell-updates/maintained) package is still broken at the time of merge, we will only merge if the maintainer has been pinged 7 days in advance. (If you care about a Haskell package, become a maintainer!)
110+111+---
112+113+This is the follow-up to #${curr_haskell_updates_pr_num}. Come to [#haskell:nixos.org](https://matrix.to/#/#haskell:nixos.org) if you have any questions.
114+EOF
115+)
116+117+echo "Opening a PR for the next haskell-updates merge cycle"
118+gh pr create --repo NixOS/nixpkgs --base master --head haskell-updates --title "haskellPackages: update stackage and hackage" --body "$new_pr_body"
···1{
2- "commit": "aceceb24b5b4dc95017c3509add3f935d7289cd8",
3- "url": "https://github.com/commercialhaskell/all-cabal-hashes/archive/aceceb24b5b4dc95017c3509add3f935d7289cd8.tar.gz",
4- "sha256": "0bc4csxmm64qq3sxj22g4i0s2q5vpgkf2fgpby6zslhpa01pdlqq",
5- "msg": "Update from Hackage at 2021-09-10T22:56:58Z"
6}
···1{
2+ "commit": "6b93e40198f31ac2a9d52e4f3ce90f22f1e9e6f9",
3+ "url": "https://github.com/commercialhaskell/all-cabal-hashes/archive/6b93e40198f31ac2a9d52e4f3ce90f22f1e9e6f9.tar.gz",
4+ "sha256": "1zs9d0h55q6lj3v0d0n19yxl58lhn07lmnw2j5k2y8zbx3pcqi8l",
5+ "msg": "Update from Hackage at 2021-09-17T18:08:40Z"
6}
+11-3
pkgs/development/compilers/ghcjs/8.10/default.nix
···108109 inherit passthru;
110111- # The emscripten is broken on darwin
112- meta.platforms = lib.platforms.linux;
113- meta.maintainers = with lib.maintainers; [ obsidian-systems-maintenance ];
00000000114 }
···108109 inherit passthru;
110111+ meta = {
112+ # The emscripten is broken on darwin
113+ platforms = lib.platforms.linux;
114+115+ # Hydra limits jobs to only outputting 1 gigabyte worth of files.
116+ # GHCJS outputs over 3 gigabytes.
117+ # https://github.com/NixOS/nixpkgs/pull/137066#issuecomment-922335563
118+ hydraPlatforms = lib.platforms.none;
119+120+ maintainers = with lib.maintainers; [ obsidian-systems-maintenance ];
121+ };
122 }
···2021Each of these steps is described in a separate section.
22000023## Initial `haskell-updates` PR
2425In this section we create the PR for merging `haskell-updates` into `master`.
···46471. Push these commits to the `haskell-updates` branch of the NixOS/nixpkgs repository.
4849-1. Open a PR on Nixpkgs merging `haskell-updates` into `master`.
50-51-52-53-Use the title `haskellPackages: update stackage and hackage` and the following message body:
54-55-```markdown
56-### This Merge
57-58-This PR is the regular merge of the `haskell-updates` branch into `master`.
59-60-This branch is being continually built and tested by hydra at https://hydra.nixos.org/jobset/nixpkgs/haskell-updates.
61-62-I will aim to merge this PR **by 2021-TODO-TODO**. If I can merge it earlier, there might be successor PRs in that time window. As part of our rotation @TODO will continue these merges from 2021-TODO-TODO to 2021-TODO-TODO.
63-64-### haskellPackages Workflow Summary
65-66-Our workflow is currently described in
67-[`pkgs/development/haskell-modules/HACKING.md`](https://github.com/NixOS/nixpkgs/blob/haskell-updates/pkgs/development/haskell-modules/HACKING.md).
68-69-The short version is this:
70-* We regularly update the Stackage and Hackage pins on `haskell-updates` (normally at the beginning of a merge window).
71-* The community fixes builds of Haskell packages on that branch.
72-* We aim at at least one merge of `haskell-updates` into `master` every two weeks.
73-* We only do the merge if the [`mergeable`](https://hydra.nixos.org/job/nixpkgs/haskell-updates/mergeable) job is succeeding on hydra.
74-* If a [`maintained`](https://hydra.nixos.org/job/nixpkgs/haskell-updates/maintained) package is still broken at the time of merge, we will only merge if the maintainer has been pinged 7 days in advance. (If you care about a Haskell package, become a maintainer!)
75-76----
77-78-This is the follow-up to #TODO. Come to [#haskell:nixos.org](https://matrix.to/#/#haskell:nixos.org) if you have any questions.
79-```
80-81-Make sure to replace all TODO with the actual values.
8283## Notify Maintainers and Fix Broken Packages
84···111most recent build report.
112113Maintainers should be given at least 7 days to fix up their packages when they
114-break. If maintainers don't fix up their packages with 7 days, then they
115may be marked broken before merging `haskell-updates` into `master`.
116117### Fix Broken Packages
···180181- All updated files will be committed.
182183-### Merge `master` into `haskell-updates`
184-185-You should occasionally merge the `master` branch into the `haskell-updates`
186-branch.
187-188-In an ideal world, when we merge `haskell-updates` into `master`, it would
189-cause few Hydra rebuilds on `master`. Ideally, the `nixos-unstable` channel
190-would never be prevented from progressing because of needing to wait for
191-rebuilding Haskell packages.
192-193-In order to make sure that there are a minimal number of rebuilds after merging
194-`haskell-updates` into `master`, `master` should occasionally be merged into
195-the `haskell-updates` branch.
196-197-This is especially important after `staging-next` is merged into `master`,
198-since there is a high chance that this will cause all the Haskell packages to
199-rebuild.
200-201## Merge `haskell-updates` into `master`
202203Now it is time to merge the `haskell-updates` PR you opened above.
···241After merging, **make sure not to delete the `haskell-updates` branch**, since it
242causes all currently open Haskell-related pull-requests to be automatically closed on GitHub.
243000000000000000000000000000000000000000000000000244## Update Hackage Version Information
245246-After merging into `master` you can update what hackage displays as the current
247-version in NixOS for every individual package.
248-To do this you run `maintainers/scripts/haskell/upload-nixos-package-list-to-hackage.sh`.
249-See the script for how to provide credentials. Once you have configured that
250running this takes only a few seconds.
251252## Additional Info
···2021Each of these steps is described in a separate section.
2223+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.
26+27## Initial `haskell-updates` PR
2829In this section we create the PR for merging `haskell-updates` into `master`.
···50511. Push these commits to the `haskell-updates` branch of the NixOS/nixpkgs repository.
5253+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.
00000000000000000000000000000005556## Notify Maintainers and Fix Broken Packages
57···84most recent build report.
8586Maintainers 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
88may be marked broken before merging `haskell-updates` into `master`.
8990### Fix Broken Packages
···153154- All updated files will be committed.
155000000000000000000156## Merge `haskell-updates` into `master`
157158Now it is time to merge the `haskell-updates` PR you opened above.
···196After merging, **make sure not to delete the `haskell-updates` branch**, since it
197causes all currently open Haskell-related pull-requests to be automatically closed on GitHub.
198199+## Script for Merging `haskell-updates` and Opening a New PR
200+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:
204+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.
208+209+ ```console
210+ $ gh auth login
211+ ```
212+213+1. Make sure you have correctly marked packages broken. One of the previous
214+ sections explains how to do this.
215+216+1. Merge `master` into `haskell-updates` and make sure to push to the
217+ `haskell-updates` branch. (This can be skipped if `master` has recently
218+ been merged into `haskell-updates`.)
219+220+1. Go to https://hydra.nixos.org/jobset/nixpkgs/haskell-updates and force an
221+ evaluation of the `haskell-updates` jobset. See one of the following
222+ sections for how to do this. Make sure there are no evaluation errors. If
223+ there are remaining evaluation errors, fix them before continuing with this
224+ merge.
225+226+1. Run the script to merge `haskell-updates`:
227+228+ ```console
229+ $ ./maintainers/scripts/haskell/merge-and-open-pr.sh PR_NUM_OF_CURRENT_HASKELL_UPDATES_PR
230+ ```
231+232+ This does the following things:
233+234+ 1. Fetches `origin`, makes sure you currently have the `haskell-updates`
235+ branch checked out, and makes sure your currently checked-out
236+ `haskell-updates` branch is on the same commit as
237+ `origin/haskell-updates`.
238+239+ 1. Merges the currently open `haskell-updates` PR.
240+241+ 1. Updates Stackage and Hackage snapshots. Regenerates the Haskell package set.
242+243+ 1. Pushes the commits updating Stackage and Hackage and opens a new
244+ `haskell-updates` PR on Nixpkgs. If you'd like to do this by hand,
245+ look in the script for the recommended PR title and body text.
246+247## Update Hackage Version Information
248249+After merging into `master` you can update what Hackage displays as the current
250+version in NixOS for every individual package. To do this you run
251+`maintainers/scripts/haskell/upload-nixos-package-list-to-hackage.sh`. See the
252+script for how to provide credentials. Once you have configured credentials,
253running this takes only a few seconds.
254255## Additional Info
···1314 buildInputs = [ openssl ];
1516+ # Force the systemd service file to be regenerated from it's template. This
17+ # file is erroneously added in version 35 and it has already been deleted from
18+ # upstream's git repository. So this "postPatch" phase can be deleted in next
19+ # release.
20+ postPatch = ''
21+ rm -f systemd/smartdns.service
22+ '';
23+24 makeFlags = [
25 "PREFIX=${placeholder "out"}"
26 "SYSTEMDSYSTEMUNITDIR=${placeholder "out"}/lib/systemd/system"