uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,353 @@
# 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 `master` branch. Each member of the team
takes a two week period where they are in charge of merging the
`haskell-updates` branch into `master`. 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 `master`
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 `master` 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 `master`.
1. Make sure the `haskell-updates` branch is up-to-date 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 `master`. 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 `hyda-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 `master`.
### 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)
jobs. These are both defined in
[`release-haskell.nix`](../../top-level/release-haskell.nix).
`mergeable` is a set of the most important Haskell packages, including things
like Pandoc and XMonad. These packages are widely used. We would like to
always keep these building.
`maintained` is a set of Haskell packages that have maintainers in Nixpkgs.
We should be proactive in working with maintainers to keep their packages
building.
Steps to fix Haskell packages that are failing to build is out of scope for
this document, but it usually requires fixing up dependencies that are now
out-of-bounds.
### Mark Broken Packages
Packages that do not get fixed can be marked broken with the following
commands. First check which packages are broken:
```console
$ ./maintainers/scripts/haskell/hydra-report.hs get-report
$ ./maintainers/scripts/haskell/hydra-report.hs mark-broken-list
```
This shows a list of packages that reported a build failure on `x86_64-linux` on Hydra.
Next, run the following command:
```console
$ ./maintainers/scripts/haskell/mark-broken.sh --do-commit
```
This first opens up an editor with the broken package list. Some of these
packages may have a maintainer in Nixpkgs. If these maintainers have not been
given 7 days to fix up their package, then make sure to remove those packages
from the list before continuing. After saving and exiting the editor, the
following will happen:
- Packages from the list will be added to
[`configuration-hackage2nix/broken.yaml`](configuration-hackage2nix/broken.yaml).
This is a list of Haskell packages that are known to be broken.
- [`hackage-packages.nix`](hackage-packages.nix) will be regenerated. This
will mark all Haskell pacakges in `configuration-hackage2nix/broken.yaml`
as `broken`.
- The
[`configuration-hackage2nix/transitive-broken.yaml`](configuration-hackage2nix/transitive-broken.yaml)
file will be updated. This is a list of Haskell packages that
depend on a package in `configuration-hackage2nix/broken.yaml` or
`configuration-hackage2nix/transitive-broken.yaml`
- `hackage-packages.nix` will be regenerated again. This will set
`hydraPlatforms = none` for all the packages in
`configuration-hackage2nix/transitive-broken.yaml`. This makes
sure that Hydra does not try to build any of these packages.
- All updated files will be committed.
## Merge `haskell-updates` into `master`
Now it is time to merge the `haskell-updates` PR you opened above.
Before doing this, make sure of the following:
- All Haskell packages that fail to build are correctly marked broken or
transitively broken.
- The `maintained` and `mergeable` jobs are passing on Hydra.
- The maintainers for any maintained Haskell packages that are newly broken
have been pinged on GitHub and given at least a week to fix their packages.
This is especially important for widely-used packages like `cachix`.
- Make sure you first merge the `master` branch into `haskell-updates`. Wait
for Hydra to evaluate the new `haskell-updates` jobset. Make sure you only
merge `haskell-updates` into `master` when there are no evaluation errors.
- Due to Hydra having only a small number of Darwin build machines, the
`haskell-updates` jobset on Hydra often has many queued Darwin jobs.
In order to not have these queued Darwin jobs prevent the `haskell-updates`
branch from being merged to `master` in a timely manner, we have special
rules for Darwin jobs.
- It is alright to merge the `haskell-updates` branch to `master` if
there are remaining queued Darwin jobs on Hydra.
- We would like to keep GHC and the `mergeable` job building on Darwin.
Do not merge the `haskell-updates` branch to `master` if GHC is failing
to build, or the `mergeable` job has failing Darwin constituent jobs.
If GHC and the `mergeable` job are not failing, but merely queued,
it is alright to merge the `haskell-updates` branch to `master`.
- We do not need to keep the `maintained` job building on Darwin.
If `maintained` packages are failing on Darwin, it is helpful to
mark them as broken on that platform.
When you've double-checked these points, go ahead and merge the `haskell-updates` PR.
After merging, **make sure not to delete the `haskell-updates` branch**, since it
causes all currently open Haskell-related pull-requests to be automatically closed on GitHub.
## Script for Merging `haskell-updates` and Opening a New PR
There is a script that automates merging the current `haskell-updates` PR and
opening the next one. When you want to merge the currently open
`haskell-updates` PR, you can run the script with the following steps:
1. Make sure you have previously authenticated with the `gh` command. The
script uses the `gh` command to merge the current PR and open a new one.
You should only need to do this once.
This command can be used to authenticate:
```console
$ gh auth login
```
This command can be used to confirm that you have already authenticated:
```console
$ gh auth status
```
1. Make sure you have setup your `~/.cabal/config` file for authentication
for uploading the NixOS package versions to Hackage. See the following
section for details on how to do this.
1. Make sure you have correctly marked packages broken. One of the previous
sections explains how to do this.
In short:
```console
$ ./maintainers/scripts/haskell/hydra-report.hs get-report
$ ./maintainers/scripts/haskell/hydra-report.hs mark-broken-list
$ ./maintainers/scripts/haskell/mark-broken.sh --do-commit
```
1. Merge `master` into `haskell-updates` and make sure to push to the
`haskell-updates` branch. (This can be skipped if `master` has recently
been merged into `haskell-updates`.)
1. Go to https://hydra.nixos.org/jobset/nixpkgs/haskell-updates and force an
evaluation of the `haskell-updates` jobset. See one of the following
sections for how to do this. Make sure there are no evaluation errors. If
there are remaining evaluation errors, fix them before continuing with this
merge.
1. Run the script to merge `haskell-updates`:
```console
$ ./maintainers/scripts/haskell/merge-and-open-pr.sh PR_NUM_OF_CURRENT_HASKELL_UPDATES_PR
```
This does the following things:
1. Fetches `origin`, makes sure you currently have the `haskell-updates`
branch checked out, and makes sure your currently checked-out
`haskell-updates` branch is on the same commit as
`origin/haskell-updates`.
1. Merges the currently open `haskell-updates` PR.
1. Updates the version of Haskell packages in NixOS on Hackage.
1. Updates Stackage and Hackage snapshots. Regenerates the Haskell package set.
1. Pushes the commits updating Stackage and Hackage and opens a new
`haskell-updates` PR on Nixpkgs. If you'd like to do this by hand,
look in the script for the recommended PR title and body text.
## Update Hackage Version Information
After merging into `master` you can update what Hackage displays as the current
version in NixOS for every individual package. To do this you run
`maintainers/scripts/haskell/upload-nixos-package-list-to-hackage.sh`. See the
script for how to provide credentials. Once you have configured credentials,
running this takes only a few seconds.
## Additional Info
Here are some additional tips that didn't fit in above.
- Hydra tries to evaluate the `haskell-updates` branch (in the
[`nixpkgs:haskell-updates`](https://hydra.nixos.org/jobset/nixpkgs/haskell-updates)
jobset) every 4 hours. It is possible to force a new Hydra evaluation without
waiting 4 hours by the following steps:
1. Log into Hydra with your GitHub or Google account.
1. Go to the [nixpkgs:haskell-updates](https://hydra.nixos.org/jobset/nixpkgs/haskell-updates) jobset.
1. Click the `Actions` button.
1. Select `Evaluate this jobset`.
1. If you refresh the page, there should be a new `Evaluation running since:` line.
1. Evaluations take about 10 minutes to finish.
- It is sometimes helpful to update the version of
[`cabal2nix` / `hackage2nix`](https://github.com/NixOS/cabal2nix) that our
maintainer scripts use. This can be done with the
[`maintainers/scripts/haskell/update-cabal2nix-unstable.sh`](../../../maintainers/scripts/haskell/update-cabal2nix-unstable.sh)
script.
You might want to do this if a user contributes a fix to `cabal2nix` that
will immediately fix a Haskell package in Nixpkgs. First, merge in
the PR to `cabal2nix`, then run `update-cabal2nix-upstable.sh`. Finally, run
[`regenerate-hackage-packages.sh`](../../../maintainers/scripts/haskell/regenerate-hackage-packages.sh)
to regenerate the Hackage package set with the updated version of `hackage2nix`.
- Make sure never to update the Hackage package hashes in
[`pkgs/data/misc/hackage/`](../../../pkgs/data/misc/hackage/), or the
pinned Stackage Nightly versions on the release branches (like
`release-21.05`).
This means that the
[`update-hackage.sh`](../../../maintainers/scripts/haskell/update-hackage.sh)
and
[`update-stackage.sh`](../../../maintainers/scripts/haskell/update-stackage.sh)
scripts should never be used on the release branches.
However, changing other files in `./.` and regenerating the package set is encouraged.
This can be done with
[`regenerate-hackage-packages.sh`](../../../maintainers/scripts/haskell/regenerate-hackage-packages.sh)
as described above.
- The Haskell team members generally hang out in the Matrix room
[#haskell:nixos.org](https://matrix.to/#/#haskell:nixos.org).
- This is a checklist for things that need to happen when a new
member is added to the Nixpkgs Haskell team.
1. Add the person to the
[@NixOS/haskell](https://github.com/orgs/NixOS/teams/haskell)
team. You may need to ask someone in the NixOS organization
to do this, like [@domenkozar](https://github.com/domenkozar).
This gives the new member access to the GitHub repos like
[cabal2nix](https://github.com/NixOS/cabal2nix).
1. Add the person as a maintainer for the following packages
on Hackage:
- https://hackage.haskell.org/package/cabal2nix
- https://hackage.haskell.org/package/distribution-nixpkgs
- https://hackage.haskell.org/package/hackage-db
- https://hackage.haskell.org/package/jailbreak-cabal
- https://hackage.haskell.org/package/language-nix
1. Add the person to the `haskell` team in
[`maintainers/team-list.nix`](../../../maintainers/team-list.nix).
This team is responsible for some important packages in
[release-haskell.nix](../../top-level/release-haskell.nix).
1. Update the
[Nextcloud Calendar](https://cloud.maralorn.de/apps/calendar/p/H6migHmKX7xHoTFa)
and work the new member into the `haskell-updates` rotation.
1. Optionally, have the new member add themselves to the Haskell
section in [`CODEOWNERS`](../../../.github/CODEOWNERS). This
will cause them to get pinged on most Haskell-related PRs.

View file

@ -0,0 +1,40 @@
# This file defines cabal2nix-unstable, used by maintainers/scripts/haskell/regenerate-hackage-packages.sh.
{ mkDerivation, aeson, ansi-wl-pprint, base, bytestring, Cabal
, containers, deepseq, directory, distribution-nixpkgs, fetchzip
, filepath, hackage-db, hopenssl, hpack, language-nix, lens, lib
, monad-par, monad-par-extras, mtl, optparse-applicative, pretty
, process, split, tasty, tasty-golden, text, time, transformers
, yaml
}:
mkDerivation {
pname = "cabal2nix";
version = "unstable-2022-04-27";
src = fetchzip {
url = "https://github.com/NixOS/cabal2nix/archive/40823c793b4b8588fcfedc8fb147c1a92cfa577d.tar.gz";
sha256 = "0gr8hafa282m4qw5y5wrqiwm1a3fl3b7xicnzixss6nlmxmi2skp";
};
isLibrary = true;
isExecutable = true;
libraryHaskellDepends = [
aeson ansi-wl-pprint base bytestring Cabal containers deepseq
directory distribution-nixpkgs filepath hackage-db hopenssl hpack
language-nix lens optparse-applicative pretty process split text
time transformers yaml
];
executableHaskellDepends = [
aeson base bytestring Cabal containers directory
distribution-nixpkgs filepath hopenssl language-nix lens monad-par
monad-par-extras mtl optparse-applicative pretty
];
testHaskellDepends = [
base Cabal containers directory filepath language-nix lens pretty
process tasty tasty-golden
];
preCheck = ''
export PATH="$PWD/dist/build/cabal2nix:$PATH"
export HOME="$TMPDIR/home"
'';
homepage = "https://github.com/nixos/cabal2nix#readme";
description = "Convert Cabal files into Nix build instructions";
license = lib.licenses.bsd3;
}

View file

@ -0,0 +1,118 @@
# ARM-SPECIFIC OVERRIDES FOR THE HASKELL PACKAGE SET IN NIXPKGS
#
# This extension is applied to all haskell package sets in nixpkgs
# if `stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64`
# to apply arm specific workarounds or fixes.
#
# The file is split into three parts:
#
# * Overrides that are applied for all arm platforms
# * Overrides for aarch32 platforms
# * Overrides for aarch64 platforms
#
# This may be extended in the future to also include compiler-
# specific sections as compiler and linker related bugs may
# get fixed subsequently.
#
# When adding new overrides, try to research which section they
# belong into. Most likely we'll be favouring aarch64 overrides
# in practice since that is the only platform we can test on
# Hydra. Also take care to group overrides by the issue they
# solve, so refactors and updates to this file are less tedious.
{ pkgs, haskellLib }:
let
inherit (pkgs) lib;
in
with haskellLib;
self: super: {
# COMMON ARM OVERRIDES
# moved here from configuration-common.nix, no reason given.
servant-docs = dontCheck super.servant-docs;
swagger2 = dontHaddock (dontCheck super.swagger2);
# Similar to https://ghc.haskell.org/trac/ghc/ticket/13062
happy = dontCheck super.happy;
happy_1_19_12 = doDistribute (dontCheck super.happy_1_19_12);
} // lib.optionalAttrs pkgs.stdenv.hostPlatform.isAarch64 {
# AARCH64-SPECIFIC OVERRIDES
# Doctests fail on aarch64 due to a GHCi linking bug
# https://gitlab.haskell.org/ghc/ghc/-/issues/15275#note_295437
# TODO: figure out if needed on aarch32 as well
BNFC = dontCheck super.BNFC;
C-structs = dontCheck super.C-structs;
Chart-tests = dontCheck super.Chart-tests;
Jikka = dontCheck super.Jikka;
accelerate = dontCheck super.accelerate;
ad = dontCheck super.ad;
autoapply = dontCheck super.autoapply;
construct = dontCheck super.construct;
exact-real = dontCheck super.exact-real;
flight-kml = dontCheck super.flight-kml;
focuslist = dontCheck super.focuslist;
grammatical-parsers = dontCheck super.grammatical-parsers;
greskell = dontCheck super.greskell;
groupBy = dontCheck super.groupBy;
haskell-time-range = dontCheck super.haskell-time-range;
headroom = dontCheck super.headroom;
hgeometry = dontCheck super.hgeometry;
hhp = dontCheck super.hhp;
hls-splice-plugin = dontCheck super.hls-splice-plugin;
hsakamai = dontCheck super.hsakamai;
hsemail-ns = dontCheck super.hsemail-ns;
html-validator-cli = dontCheck super.html-validator-cli;
hw-fingertree-strict = dontCheck super.hw-fingertree-strict;
hw-packed-vector = dontCheck super.hw-packed-vector;
hw-prim = dontCheck super.hw-prim;
hw-xml = dontCheck super.hw-xml;
language-nix = dontCheck super.language-nix;
lens-regex = dontCheck super.lens-regex;
meep = dontCheck super.meep;
openapi3 = dontCheck super.openapi3;
orbits = dontCheck super.orbits;
ranged-list = dontCheck super.ranged-list;
rank2classes = dontCheck super.rank2classes;
schedule = dontCheck super.schedule;
static = dontCheck super.static;
strict-writer = dontCheck super.strict-writer;
termonad = dontCheck super.termonad;
trifecta = dontCheck super.trifecta;
twiml = dontCheck super.twiml;
twitter-conduit = dontCheck super.twitter-conduit;
validationt = dontCheck super.validationt;
vgrep = dontCheck super.vgrep;
vinyl = dontCheck super.vinyl;
vulkan-utils = dontCheck super.vulkan-utils;
xml-html-qq = dontCheck super.xml-html-qq;
yaml-combinators = dontCheck super.yaml-combinators;
yesod-paginator = dontCheck super.yesod-paginator;
hls-pragmas-plugin = dontCheck super.hls-pragmas-plugin;
hls-call-hierarchy-plugin = dontCheck super.hls-call-hierarchy-plugin;
hls-module-name-plugin = dontCheck super.hls-module-name-plugin;
hls-brittany-plugin = dontCheck super.hls-brittany-plugin;
hls-qualify-imported-names-plugin = dontCheck super.hls-qualify-imported-names-plugin;
hls-class-plugin = dontCheck super.hls-class-plugin;
hls-selection-range-plugin = dontCheck super.hls-selection-range-plugin;
# https://github.com/ekmett/half/issues/35
half = dontCheck super.half;
# We disable profiling on aarch64, so tests naturally fail
ghc-prof = dontCheck super.ghc-prof;
# Similar RTS issue in test suite:
# rts/linker/elf_reloc_aarch64.c:98: encodeAddendAarch64: Assertion `isInt64(21+12, addend)' failed.
# These still fail sporadically on ghc 9.2
hls-ormolu-plugin = dontCheck super.hls-ormolu-plugin;
hls-haddock-comments-plugin = dontCheck super.hls-haddock-comments-plugin;
hls-rename-plugin = dontCheck super.hls-rename-plugin;
hls-fourmolu-plugin = dontCheck super.hls-fourmolu-plugin;
} // lib.optionalAttrs pkgs.stdenv.hostPlatform.isAarch32 {
# AARCH32-SPECIFIC OVERRIDES
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,297 @@
# DARWIN-SPECIFIC OVERRIDES FOR THE HASKELL PACKAGE SET IN NIXPKGS
{ pkgs, haskellLib }:
let
inherit (pkgs) lib darwin;
in
with haskellLib;
self: super: ({
# the tests for shell-conduit on Darwin illegitimatey assume non-GNU echo
# see: https://github.com/psibi/shell-conduit/issues/12
shell-conduit = dontCheck super.shell-conduit;
conduit-extra = super.conduit-extra.overrideAttrs (drv: {
__darwinAllowLocalNetworking = true;
});
halive = addBuildDepend darwin.apple_sdk.frameworks.AppKit super.halive;
# Hakyll's tests are broken on Darwin (3 failures); and they require util-linux
hakyll = overrideCabal {
testToolDepends = [];
doCheck = false;
} super.hakyll;
barbly = addBuildDepend darwin.apple_sdk.frameworks.AppKit super.barbly;
double-conversion = addExtraLibrary pkgs.libcxx super.double-conversion;
streamly = addBuildDepend darwin.apple_sdk.frameworks.Cocoa super.streamly;
apecs-physics = addPkgconfigDepends [
darwin.apple_sdk.frameworks.ApplicationServices
] super.apecs-physics;
# "erf table" test fails on Darwin
# https://github.com/bos/math-functions/issues/63
math-functions = dontCheck super.math-functions;
# darwin doesn't have sub-second resolution
# https://github.com/hspec/mockery/issues/11
mockery = overrideCabal (drv: {
preCheck = ''
export TRAVIS=true
'' + (drv.preCheck or "");
}) super.mockery;
# https://github.com/ndmitchell/shake/issues/206
shake = dontCheck super.shake;
filecache = dontCheck super.filecache;
# gtk/gtk3 needs to be told on Darwin to use the Quartz
# rather than X11 backend (see eg https://github.com/gtk2hs/gtk2hs/issues/249).
gtk3 = appendConfigureFlag "-f have-quartz-gtk" super.gtk3;
gtk = appendConfigureFlag "-f have-quartz-gtk" super.gtk;
OpenAL = addExtraLibrary darwin.apple_sdk.frameworks.OpenAL super.OpenAL;
al = overrideCabal (drv: {
libraryFrameworkDepends = [
darwin.apple_sdk.frameworks.OpenAL
] ++ (drv.libraryFrameworkDepends or []);
}) super.al;
proteaaudio = addExtraLibrary darwin.apple_sdk.frameworks.AudioToolbox super.proteaaudio;
# the system-fileio tests use canonicalizePath, which fails in the sandbox
system-fileio = dontCheck super.system-fileio;
# Prevents needing to add `security_tool` as a run-time dependency for
# everything using x509-system to give access to the `security` executable.
#
# darwin.security_tool is broken in Mojave (#45042)
#
# We will use the system provided security for now.
# Beware this WILL break in sandboxes!
#
# TODO(matthewbauer): If someone really needs this to work in sandboxes,
# I think we can add a propagatedImpureHost dep here, but Im hoping to
# get a proper fix available soonish.
x509-system = overrideCabal (drv:
lib.optionalAttrs (!pkgs.stdenv.cc.nativeLibc) {
postPatch = ''
substituteInPlace System/X509/MacOS.hs --replace security /usr/bin/security
'' + (drv.postPatch or "");
}) super.x509-system;
# https://github.com/haskell-foundation/foundation/pull/412
foundation = dontCheck super.foundation;
llvm-hs = overrideCabal (oldAttrs: {
# One test fails on darwin.
doCheck = false;
# llvm-hs's Setup.hs file tries to add the lib/ directory from LLVM8 to
# the DYLD_LIBRARY_PATH environment variable. This messes up clang
# when called from GHC, probably because clang is version 7, but we are
# using LLVM8.
preCompileBuildDriver = ''
substituteInPlace Setup.hs --replace "addToLdLibraryPath libDir" "pure ()"
'' + (oldAttrs.preCompileBuildDriver or "");
}) super.llvm-hs;
yesod-bin = addBuildDepend darwin.apple_sdk.frameworks.Cocoa super.yesod-bin;
hmatrix = addBuildDepend darwin.apple_sdk.frameworks.Accelerate super.hmatrix;
blas-hs = overrideCabal (drv: {
libraryFrameworkDepends = [
darwin.apple_sdk.frameworks.Accelerate
] ++ (drv.libraryFrameworkDepends or []);
}) super.blas-hs;
# Ensure the necessary frameworks are propagatedBuildInputs on darwin
OpenGLRaw = overrideCabal (drv: {
librarySystemDepends = [];
libraryHaskellDepends = drv.libraryHaskellDepends ++ [
darwin.apple_sdk.frameworks.OpenGL
];
preConfigure = ''
frameworkPaths=($(for i in $nativeBuildInputs; do if [ -d "$i"/Library/Frameworks ]; then echo "-F$i/Library/Frameworks"; fi done))
frameworkPaths=$(IFS=, ; echo "''${frameworkPaths[@]}")
configureFlags+=$(if [ -n "$frameworkPaths" ]; then echo -n "--ghc-options=-optl=$frameworkPaths"; fi)
'' + (drv.preConfigure or "");
}) super.OpenGLRaw;
GLURaw = overrideCabal (drv: {
librarySystemDepends = [];
libraryHaskellDepends = drv.libraryHaskellDepends ++ [
darwin.apple_sdk.frameworks.OpenGL
];
}) super.GLURaw;
bindings-GLFW = overrideCabal (drv: {
librarySystemDepends = [];
libraryHaskellDepends = drv.libraryHaskellDepends ++ [
darwin.apple_sdk.frameworks.AGL
darwin.apple_sdk.frameworks.Cocoa
darwin.apple_sdk.frameworks.OpenGL
darwin.apple_sdk.frameworks.IOKit
darwin.apple_sdk.frameworks.Kernel
darwin.apple_sdk.frameworks.CoreVideo
darwin.CF
];
}) super.bindings-GLFW;
OpenCL = overrideCabal (drv: {
librarySystemDepends = [];
libraryHaskellDepends = drv.libraryHaskellDepends ++ [
darwin.apple_sdk.frameworks.OpenCL
];
}) super.OpenCL;
# cabal2nix likes to generate dependencies on hinotify when hfsevents is
# really required on darwin: https://github.com/NixOS/cabal2nix/issues/146.
hinotify = self.hfsevents;
# FSEvents API is very buggy and tests are unreliable. See
# http://openradar.appspot.com/10207999 and similar issues.
fsnotify = addBuildDepend darwin.apple_sdk.frameworks.Cocoa
(dontCheck super.fsnotify);
FractalArt = overrideCabal (drv: {
librarySystemDepends = [
darwin.libobjc
darwin.apple_sdk.frameworks.AppKit
] ++ (drv.librarySystemDepends or []);
}) super.FractalArt;
arbtt = overrideCabal (drv: {
librarySystemDepends = [
darwin.apple_sdk.frameworks.Foundation
darwin.apple_sdk.frameworks.Carbon
darwin.apple_sdk.frameworks.IOKit
] ++ (drv.librarySystemDepends or []);
}) super.arbtt;
HTF = overrideCabal (drv: {
# GNU find is not prefixed in stdenv
postPatch = ''
substituteInPlace scripts/local-htfpp --replace "find=gfind" "find=find"
'' + (drv.postPatch or "");
}) super.HTF;
# conditional dependency via a cabal flag
cas-store = overrideCabal (drv: {
libraryHaskellDepends = [
self.kqueue
] ++ (drv.libraryHaskellDepends or []);
}) super.cas-store;
# 2021-05-25: Tests fail and I have no way to debug them.
hls-class-plugin = dontCheck super.hls-class-plugin;
hls-brittany-plugin = dontCheck super.hls-brittany-plugin;
hls-fourmolu-plugin = dontCheck super.hls-fourmolu-plugin;
hls-module-name-plugin = dontCheck super.hls-module-name-plugin;
hls-splice-plugin = dontCheck super.hls-splice-plugin;
hls-ormolu-plugin = dontCheck super.hls-ormolu-plugin;
hls-pragmas-plugin = dontCheck super.hls-pragmas-plugin;
hls-haddock-comments-plugin = dontCheck super.hls-haddock-comments-plugin;
hls-floskell-plugin = dontCheck super.hls-floskell-plugin;
hls-call-hierarchy-plugin = dontCheck super.hls-call-hierarchy-plugin;
# 2022-05-05: Tests fail and I have no way to debug them.
hls-rename-plugin = dontCheck super.hls-rename-plugin;
# We are lacking pure pgrep at the moment for tests to work
tmp-postgres = dontCheck super.tmp-postgres;
# On darwin librt doesn't exist and will fail to link against,
# however linking against it is also not necessary there
GLHUI = overrideCabal (drv: {
postPatch = ''
substituteInPlace GLHUI.cabal --replace " rt" ""
'' + (drv.postPatch or "");
}) super.GLHUI;
SDL-image = overrideCabal (drv: {
# Prevent darwin-specific configuration code path being taken
# which doesn't work with nixpkgs' SDL libraries
postPatch = ''
substituteInPlace configure --replace xDarwin noDarwinSpecialCasing
'' + (drv.postPatch or "");
patches = [
# Work around SDL_main.h redefining main to SDL_main
./patches/SDL-image-darwin-hsc.patch
];
}) super.SDL-image;
# Prevent darwin-specific configuration code path being taken which
# doesn't work with nixpkgs' SDL libraries
SDL-mixer = overrideCabal (drv: {
postPatch = ''
substituteInPlace configure --replace xDarwin noDarwinSpecialCasing
'' + (drv.postPatch or "");
}) super.SDL-mixer;
# Work around SDL_main.h redefining main to SDL_main
SDL-ttf = appendPatch ./patches/SDL-ttf-darwin-hsc.patch super.SDL-ttf;
# Disable a bunch of test suites that fail because of darwin's case insensitive
# file system: When a test suite has a test suite file that has the same name
# as a module in scope, but in different case (e. g. hedgehog.hs and Hedgehog
# in scope), GHC will complain that the file name and module name differ (in
# the example hedgehog.hs would be Main).
# These failures can easily be fixed by upstream by renaming files, so we
# should create issues for them.
# https://github.com/typeclasses/aws-cloudfront-signed-cookies/issues/2
aws-cloudfront-signed-cookies = dontCheck super.aws-cloudfront-signed-cookies;
# https://github.com/acid-state/acid-state/issues/133
acid-state = dontCheck super.acid-state;
# Otherwise impure gcc is used, which is Apple's weird wrapper
c2hsc = addTestToolDepends [ pkgs.gcc ] super.c2hsc;
http-client-tls = overrideCabal (drv: {
postPatch = ''
# This comment has been inserted, so the derivation hash changes, forcing
# a rebuild of this derivation which has succeeded to build on Hydra before,
# but apparently been corrupted, causing reverse dependencies to fail.
#
# This workaround can be removed upon the next darwin stdenv rebuild,
# presumably https://github.com/NixOS/nixpkgs/pull/152850 or the next
# full haskellPackages rebuild.
'' + drv.postPatch or "";
}) super.http-client-tls;
foldl = overrideCabal (drv: {
postPatch = ''
# This comment has been inserted, so the derivation hash changes, forcing
# a rebuild of this derivation which has succeeded to build on Hydra before,
# but apparently been corrupted, causing reverse dependencies to fail.
#
# This workaround can be removed upon the next darwin stdenv rebuild,
# presumably https://github.com/NixOS/nixpkgs/pull/152850 or the next
# full haskellPackages rebuild.
'' + drv.postPatch or "";
}) super.foldl;
} // lib.optionalAttrs pkgs.stdenv.isAarch64 { # aarch64-darwin
# https://github.com/fpco/unliftio/issues/87
unliftio = dontCheck super.unliftio;
# https://github.com/haskell-crypto/cryptonite/issues/360
cryptonite = appendPatch ./patches/cryptonite-remove-argon2.patch super.cryptonite;
} // lib.optionalAttrs pkgs.stdenv.isx86_64 { # x86_64-darwin
# tests appear to be failing to link or something:
# https://hydra.nixos.org/build/174540882/nixlog/9
regex-rure = dontCheck super.regex-rure;
# same
# https://hydra.nixos.org/build/174540882/nixlog/9
jacinda = dontCheck super.jacinda;
})

View file

@ -0,0 +1,142 @@
{ pkgs, haskellLib }:
with haskellLib;
let
inherit (pkgs.stdenv.hostPlatform) isDarwin;
in
self: super: {
llvmPackages = pkgs.lib.dontRecurseIntoAttrs self.ghc.llvmPackages;
# Disable GHC 8.10.x core libraries.
array = null;
base = null;
binary = null;
bytestring = null;
Cabal = null;
containers = null;
deepseq = null;
directory = null;
exceptions = null;
filepath = null;
ghc-boot = null;
ghc-boot-th = null;
ghc-compact = null;
ghc-heap = null;
ghc-prim = null;
ghci = null;
haskeline = null;
hpc = null;
integer-gmp = null;
libiserv = null;
mtl = null;
parsec = null;
pretty = null;
process = null;
rts = null;
stm = null;
template-haskell = null;
terminfo = null;
text = null;
time = null;
transformers = null;
unix = null;
# GHC only bundles the xhtml library if haddock is enabled, check if this is
# still the case when updating: https://gitlab.haskell.org/ghc/ghc/-/blob/0198841877f6f04269d6050892b98b5c3807ce4c/ghc.mk#L463
xhtml = if self.ghc.hasHaddock or true then null else self.xhtml_3000_2_2_1;
# cabal-install needs more recent versions of Cabal and base16-bytestring.
cabal-install = super.cabal-install.overrideScope (self: super: {
Cabal = self.Cabal_3_6_3_0;
});
# Pick right versions for GHC-specific packages
ghc-api-compat = doDistribute self.ghc-api-compat_8_10_7;
# ghc versions which dont match the ghc-lib-parser-ex version need the
# additional dependency to compile successfully.
ghc-lib-parser-ex = addBuildDepend self.ghc-lib-parser super.ghc-lib-parser-ex;
# Jailbreak to fix the build.
base-noprelude = doJailbreak super.base-noprelude;
unliftio-core = doJailbreak super.unliftio-core;
# Jailbreaking because monoidal-containers hasnt bumped it's base dependency for 8.10.
monoidal-containers = doJailbreak super.monoidal-containers;
# Jailbreak to fix the build.
brick = doJailbreak super.brick;
exact-pi = doJailbreak super.exact-pi;
serialise = doJailbreak super.serialise;
setlocale = doJailbreak super.setlocale;
shellmet = doJailbreak super.shellmet;
shower = doJailbreak super.shower;
# Apply patch from https://github.com/finnsson/template-helper/issues/12#issuecomment-611795375 to fix the build.
language-haskell-extract = appendPatch (pkgs.fetchpatch {
name = "language-haskell-extract-0.2.4.patch";
url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/e48738ee1be774507887a90a0d67ad1319456afc/patches/language-haskell-extract-0.2.4.patch?inline=false";
sha256 = "0rgzrq0513nlc1vw7nw4km4bcwn4ivxcgi33jly4a7n3c1r32v1f";
}) (doJailbreak super.language-haskell-extract);
# hnix 0.9.0 does not provide an executable for ghc < 8.10, so define completions here for now.
hnix = generateOptparseApplicativeCompletion "hnix"
(overrideCabal (drv: {
# executable is allowed for ghc >= 8.10 and needs repline
executableHaskellDepends = drv.executableToolDepends or [] ++ [ self.repline ];
}) super.hnix);
mime-string = disableOptimization super.mime-string;
# Older compilers need the latest ghc-lib to build this package.
hls-hlint-plugin = addBuildDepend self.ghc-lib (overrideCabal (drv: {
# Workaround for https://github.com/haskell/haskell-language-server/issues/2728
postPatch = ''
sed -i 's/(GHC.RealSrcSpan x,/(GHC.RealSrcSpan x Nothing,/' src/Ide/Plugin/Hlint.hs
'';
})
super.hls-hlint-plugin);
haskell-language-server = appendConfigureFlags [
"-f-stylishhaskell"
"-f-brittany"
]
super.haskell-language-server;
# has a restrictive lower bound on Cabal
fourmolu = doJailbreak super.fourmolu;
# ormolu 0.3 requires Cabal == 3.4
ormolu = super.ormolu_0_2_0_0;
# weeder 2.3.0 no longer supports GHC 8.10
weeder = doDistribute (doJailbreak self.weeder_2_2_0);
# OneTuple needs hashable instead of ghc-prim for GHC < 9
OneTuple = super.OneTuple.override {
ghc-prim = self.hashable;
};
# Doesn't build with 9.0, see https://github.com/yi-editor/yi/issues/1125
yi-core = doDistribute (markUnbroken super.yi-core);
# Temporarily disabled blaze-textual for GHC >= 9.0 causing hackage2nix ignoring it
# https://github.com/paul-rouse/mysql-simple/blob/872604f87044ff6d1a240d9819a16c2bdf4ed8f5/Database/MySQL/Internal/Blaze.hs#L4-L10
mysql-simple = addBuildDepends [
self.blaze-textual
] super.mysql-simple;
taffybar = markUnbroken (doDistribute super.taffybar);
# https://github.com/fpco/inline-c/issues/127 (recommend to upgrade to Nixpkgs GHC >=9.0)
inline-c-cpp = (if isDarwin then dontCheck else x: x) super.inline-c-cpp;
# Depends on OneTuple for GHC < 9.0
universe-base = addBuildDepends [ self.OneTuple ] super.universe-base;
# Not possible to build in the main GHC 9.0 package set
# https://github.com/awakesecurity/spectacle/issues/49
spectacle = doDistribute (markUnbroken super.spectacle);
}

View file

@ -0,0 +1,115 @@
{ pkgs, haskellLib }:
with haskellLib;
let
inherit (pkgs.stdenv.hostPlatform) isDarwin;
in
self: super: {
llvmPackages = pkgs.lib.dontRecurseIntoAttrs self.ghc.llvmPackages;
# Disable GHC 8.6.x core libraries.
array = null;
base = null;
binary = null;
bytestring = null;
Cabal = null;
containers = null;
deepseq = null;
directory = null;
filepath = null;
ghc-boot = null;
ghc-boot-th = null;
ghc-compact = null;
ghc-heap = null;
ghc-prim = null;
ghci = null;
haskeline = null;
hpc = null;
integer-gmp = null;
libiserv = null;
mtl = null;
parsec = null;
pretty = null;
process = null;
rts = null;
stm = null;
template-haskell = null;
terminfo = null;
text = null;
time = null;
transformers = null;
unix = null;
# GHC only bundles the xhtml library if haddock is enabled, check if this is
# still the case when updating: https://gitlab.haskell.org/ghc/ghc/-/blob/0198841877f6f04269d6050892b98b5c3807ce4c/ghc.mk#L463
xhtml = if self.ghc.hasHaddock or true then null else self.xhtml_3000_2_2_1;
# Needs Cabal 3.0.x.
cabal-install = super.cabal-install.overrideScope (self: super: { Cabal = self.Cabal_3_2_1_0; });
jailbreak-cabal = super.jailbreak-cabal.override { Cabal = self.Cabal_3_2_1_0; };
# https://github.com/tibbe/unordered-containers/issues/214
unordered-containers = dontCheck super.unordered-containers;
# Test suite does not compile.
data-clist = doJailbreak super.data-clist; # won't cope with QuickCheck 2.12.x
dates = doJailbreak super.dates; # base >=4.9 && <4.12
Diff = dontCheck super.Diff;
equivalence = dontCheck super.equivalence; # test suite doesn't compile https://github.com/pa-ba/equivalence/issues/5
HaTeX = doJailbreak super.HaTeX; # containers >=0.4 && <0.6 is too tight; https://github.com/Daniel-Diaz/HaTeX/issues/126
hpc-coveralls = doJailbreak super.hpc-coveralls; # https://github.com/guillaume-nargeot/hpc-coveralls/issues/82
http-api-data = doJailbreak super.http-api-data;
persistent-sqlite = dontCheck super.persistent-sqlite;
system-fileio = dontCheck super.system-fileio; # avoid dependency on broken "patience"
unicode-transforms = dontCheck super.unicode-transforms;
wl-pprint-extras = doJailbreak super.wl-pprint-extras; # containers >=0.4 && <0.6 is too tight; https://github.com/ekmett/wl-pprint-extras/issues/17
RSA = dontCheck super.RSA; # https://github.com/GaloisInc/RSA/issues/14
monad-par = dontCheck super.monad-par; # https://github.com/simonmar/monad-par/issues/66
github = dontCheck super.github; # hspec upper bound exceeded; https://github.com/phadej/github/pull/341
binary-orphans = dontCheck super.binary-orphans; # tasty upper bound exceeded; https://github.com/phadej/binary-orphans/commit/8ce857226595dd520236ff4c51fa1a45d8387b33
rebase = doJailbreak super.rebase; # time ==1.9.* is too low
# https://github.com/jgm/skylighting/issues/55
skylighting-core = dontCheck super.skylighting-core;
# Break out of "yaml >=0.10.4.0 && <0.11": https://github.com/commercialhaskell/stack/issues/4485
stack = doJailbreak super.stack;
# Newer versions don't compile.
resolv = self.resolv_0_1_1_2;
# cabal2nix needs the latest version of Cabal, and the one
# hackage-db uses must match, so take the latest
cabal2nix = super.cabal2nix.overrideScope (self: super: { Cabal = self.Cabal_3_2_1_0; });
# cabal2spec needs a recent version of Cabal
cabal2spec = super.cabal2spec.overrideScope (self: super: { Cabal = self.Cabal_3_2_1_0; });
# https://github.com/pikajude/stylish-cabal/issues/12
stylish-cabal = doDistribute (markUnbroken (super.stylish-cabal.override { haddock-library = self.haddock-library_1_7_0; }));
haddock-library_1_7_0 = dontCheck super.haddock-library_1_7_0;
# ghc versions prior to 8.8.x needs additional dependency to compile successfully.
ghc-lib-parser-ex = addBuildDepend self.ghc-lib-parser super.ghc-lib-parser-ex;
# This became a core library in ghc 8.10., so we dont have an "exception" attribute anymore.
exceptions = super.exceptions_0_10_4;
# Older compilers need the latest ghc-lib to build this package.
hls-hlint-plugin = addBuildDepend self.ghc-lib super.hls-hlint-plugin;
# vector 0.12.2 indroduced doctest checks that dont work on older compilers
vector = dontCheck super.vector;
mmorph = super.mmorph_1_1_3;
# https://github.com/haskellari/time-compat/issues/23
time-compat = dontCheck super.time-compat;
mime-string = disableOptimization super.mime-string;
# https://github.com/fpco/inline-c/issues/127 (recommend to upgrade to Nixpkgs GHC >=9.0)
inline-c-cpp = (if isDarwin then dontCheck else x: x) super.inline-c-cpp;
}

View file

@ -0,0 +1,170 @@
{ pkgs, haskellLib }:
with haskellLib;
let
inherit (pkgs.stdenv.hostPlatform) isDarwin;
in
self: super: {
llvmPackages = pkgs.lib.dontRecurseIntoAttrs self.ghc.llvmPackages;
# Disable GHC 8.8.x core libraries.
array = null;
base = null;
binary = null;
bytestring = null;
Cabal = null;
containers = null;
deepseq = null;
directory = null;
filepath = null;
ghc-boot = null;
ghc-boot-th = null;
ghc-compact = null;
ghc-heap = null;
ghc-prim = null;
ghci = null;
haskeline = null;
hpc = null;
integer-gmp = null;
libiserv = null;
mtl = null;
parsec = null;
pretty = null;
process = null;
rts = null;
stm = null;
template-haskell = null;
terminfo = null;
text = null;
time = null;
transformers = null;
unix = null;
# GHC only bundles the xhtml library if haddock is enabled, check if this is
# still the case when updating: https://gitlab.haskell.org/ghc/ghc/-/blob/0198841877f6f04269d6050892b98b5c3807ce4c/ghc.mk#L463
xhtml = if self.ghc.hasHaddock or true then null else self.xhtml_3000_2_2_1;
# GHC 8.8.x can build haddock version 2.23.*
haddock = self.haddock_2_23_1;
haddock-api = self.haddock-api_2_23_1;
# This build needs a newer version of Cabal.
cabal2spec = super.cabal2spec.override { Cabal = self.Cabal_3_2_1_0; };
# cabal-install needs more recent versions of Cabal and random, but an older
# version of base16-bytestring.
cabal-install = super.cabal-install.overrideScope (self: super: {
Cabal = self.Cabal_3_6_3_0;
});
# Ignore overly restrictive upper version bounds.
aeson-diff = doJailbreak super.aeson-diff;
async = doJailbreak super.async;
ChasingBottoms = doJailbreak super.ChasingBottoms;
chell = doJailbreak super.chell;
Diff = dontCheck super.Diff;
doctest = doJailbreak super.doctest;
hashable = doJailbreak super.hashable;
hashable-time = doJailbreak super.hashable-time;
hledger-lib = doJailbreak super.hledger-lib; # base >=4.8 && <4.13, easytest >=0.2.1 && <0.3
integer-logarithms = doJailbreak super.integer-logarithms;
lucid = doJailbreak super.lucid;
parallel = doJailbreak super.parallel;
setlocale = doJailbreak super.setlocale;
split = doJailbreak super.split;
system-fileio = doJailbreak super.system-fileio;
tasty-expected-failure = doJailbreak super.tasty-expected-failure;
tasty-hedgehog = doJailbreak super.tasty-hedgehog;
test-framework = doJailbreak super.test-framework;
th-expand-syns = doJailbreak super.th-expand-syns;
# TODO: remove when upstream accepts https://github.com/snapframework/io-streams-haproxy/pull/17
io-streams-haproxy = doJailbreak super.io-streams-haproxy; # base >=4.5 && <4.13
snap-server = doJailbreak super.snap-server;
exact-pi = doJailbreak super.exact-pi;
time-compat = doJailbreak super.time-compat;
http-media = unmarkBroken (doJailbreak super.http-media);
servant-server = unmarkBroken (doJailbreak super.servant-server);
foundation = dontCheck super.foundation;
vault = dontHaddock super.vault;
# https://github.com/snapframework/snap-core/issues/288
snap-core = overrideCabal (drv: { prePatch = "substituteInPlace src/Snap/Internal/Core.hs --replace 'fail = Fail.fail' ''"; }) super.snap-core;
# Upstream ships a broken Setup.hs file.
csv = overrideCabal (drv: { prePatch = "rm Setup.hs"; }) super.csv;
# https://github.com/kowainik/relude/issues/241
relude = dontCheck super.relude;
# The current version 2.14.2 does not compile with ghc-8.8.x or newer because
# of issues with Cabal 3.x.
darcs = dontDistribute super.darcs;
# cabal-fmt requires Cabal3
cabal-fmt = super.cabal-fmt.override { Cabal = self.Cabal_3_2_1_0; };
# liquidhaskell does not support ghc version 8.8.x.
liquid = markBroken super.liquid;
liquid-base = markBroken super.liquid-base;
liquid-bytestring = markBroken super.liquid-bytestring;
liquid-containers = markBroken super.liquid-containers;
liquid-ghc-prim = markBroken super.liquid-ghc-prim;
liquid-parallel = markBroken super.liquid-parallel;
liquid-platform = markBroken super.liquid-platform;
liquid-prelude = markBroken super.liquid-prelude;
liquid-vector = markBroken super.liquid-vector;
liquidhaskell = markBroken super.liquidhaskell;
# This became a core library in ghc 8.10., so we dont have an "exception" attribute anymore.
exceptions = super.exceptions_0_10_5;
# ghc versions which dont match the ghc-lib-parser-ex version need the
# additional dependency to compile successfully.
ghc-lib-parser-ex = addBuildDepend self.ghc-lib-parser super.ghc-lib-parser-ex;
ormolu = super.ormolu_0_2_0_0;
# vector 0.12.2 indroduced doctest checks that dont work on older compilers
vector = dontCheck super.vector;
ghc-api-compat = doDistribute super.ghc-api-compat_8_6;
mime-string = disableOptimization super.mime-string;
# Older compilers need the latest ghc-lib to build this package.
hls-hlint-plugin = addBuildDepend self.ghc-lib (overrideCabal (drv: {
# Workaround for https://github.com/haskell/haskell-language-server/issues/2728
postPatch = ''
sed -i 's/(GHC.RealSrcSpan x,/(GHC.RealSrcSpan x Nothing,/' src/Ide/Plugin/Hlint.hs
'';
})
super.hls-hlint-plugin);
haskell-language-server = appendConfigureFlags [
"-f-stylishhaskell"
"-f-brittany"
]
super.haskell-language-server;
# has a restrictive lower bound on Cabal
fourmolu = doJailbreak super.fourmolu;
# OneTuple needs hashable instead of ghc-prim for GHC < 9
OneTuple = super.OneTuple.override {
ghc-prim = self.hashable;
};
# Temporarily disabled blaze-textual for GHC >= 9.0 causing hackage2nix ignoring it
# https://github.com/paul-rouse/mysql-simple/blob/872604f87044ff6d1a240d9819a16c2bdf4ed8f5/Database/MySQL/Internal/Blaze.hs#L4-L10
mysql-simple = addBuildDepends [
self.blaze-textual
] super.mysql-simple;
# https://github.com/fpco/inline-c/issues/127 (recommend to upgrade to Nixpkgs GHC >=9.0)
inline-c-cpp = (if isDarwin then dontCheck else x: x) super.inline-c-cpp;
# Depends on OneTuple for GHC < 9.0
universe-base = addBuildDepends [ self.OneTuple ] super.universe-base;
}

View file

@ -0,0 +1,136 @@
{ pkgs, haskellLib }:
with haskellLib;
let
inherit (pkgs.stdenv.hostPlatform) isDarwin;
in
self: super: {
llvmPackages = pkgs.lib.dontRecurseIntoAttrs self.ghc.llvmPackages;
# Disable GHC 9.0.x core libraries.
array = null;
base = null;
binary = null;
bytestring = null;
Cabal = null;
containers = null;
deepseq = null;
directory = null;
exceptions = null;
filepath = null;
ghc-bignum = null;
ghc-boot = null;
ghc-boot-th = null;
ghc-compact = null;
ghc-heap = null;
ghc-prim = null;
ghci = null;
haskeline = null;
hpc = null;
integer-gmp = null;
libiserv = null;
mtl = null;
parsec = null;
pretty = null;
process = null;
rts = null;
stm = null;
template-haskell = null;
terminfo = null;
text = null;
time = null;
transformers = null;
unix = null;
# GHC only bundles the xhtml library if haddock is enabled, check if this is
# still the case when updating: https://gitlab.haskell.org/ghc/ghc/-/blob/0198841877f6f04269d6050892b98b5c3807ce4c/ghc.mk#L463
xhtml = if self.ghc.hasHaddock or true then null else self.xhtml_3000_2_2_1;
# cabal-install needs more recent versions of Cabal and base16-bytestring.
cabal-install = (doJailbreak super.cabal-install).overrideScope (self: super: {
Cabal = self.Cabal_3_6_3_0;
});
# Jailbreaks & Version Updates
# This `doJailbreak` can be removed once the following PR is released to Hackage:
# https://github.com/thsutton/aeson-diff/pull/58
aeson-diff = doJailbreak super.aeson-diff;
async = doJailbreak super.async;
data-fix = doJailbreak super.data-fix;
dec = doJailbreak super.dec;
ed25519 = doJailbreak super.ed25519;
hackage-security = doJailbreak super.hackage-security;
hashable = overrideCabal (drv: { postPatch = "sed -i -e 's,integer-gmp .*<1.1,integer-gmp < 2,' hashable.cabal"; }) (doJailbreak (dontCheck super.hashable));
hashable-time = doJailbreak super.hashable-time;
HTTP = overrideCabal (drv: { postPatch = "sed -i -e 's,! Socket,!Socket,' Network/TCP.hs"; }) (doJailbreak super.HTTP);
integer-logarithms = overrideCabal (drv: { postPatch = "sed -i -e 's,integer-gmp <1.1,integer-gmp < 2,' integer-logarithms.cabal"; }) (doJailbreak super.integer-logarithms);
lukko = doJailbreak super.lukko;
parallel = doJailbreak super.parallel;
primitive = doJailbreak (dontCheck super.primitive);
regex-posix = doJailbreak super.regex-posix;
resolv = doJailbreak super.resolv;
singleton-bool = doJailbreak super.singleton-bool;
split = doJailbreak super.split;
tar = doJailbreak super.tar;
time-compat = doJailbreak super.time-compat;
vector = doJailbreak (dontCheck super.vector);
vector-binary-instances = doJailbreak super.vector-binary-instances;
vector-th-unbox = doJailbreak super.vector-th-unbox;
zlib = doJailbreak super.zlib;
# 2021-11-08: Fixed in autoapply-0.4.2
autoapply = doJailbreak super.autoapply;
doctest = dontCheck super.doctest;
# Apply patches from head.hackage.
language-haskell-extract = appendPatch (pkgs.fetchpatch {
url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/master/patches/language-haskell-extract-0.2.4.patch";
sha256 = "0rgzrq0513nlc1vw7nw4km4bcwn4ivxcgi33jly4a7n3c1r32v1f";
}) (doJailbreak super.language-haskell-extract);
# The test suite depends on ChasingBottoms, which is broken with ghc-9.0.x.
unordered-containers = dontCheck super.unordered-containers;
# The test suite seems pretty broken.
base64-bytestring = dontCheck super.base64-bytestring;
# GHC 9.0.x doesn't like `import Spec (main)` in Main.hs
# https://github.com/snoyberg/mono-traversable/issues/192
mono-traversable = dontCheck super.mono-traversable;
# Test suite sometimes segfaults with GHC 9.0.1 and 9.0.2
# https://github.com/ekmett/reflection/issues/51
# https://gitlab.haskell.org/ghc/ghc/-/issues/21141
reflection = dontCheck super.reflection;
# Disable tests pending resolution of
# https://github.com/Soostone/retry/issues/71
retry = dontCheck super.retry;
# 2021-09-18: cabal2nix does not detect the need for ghc-api-compat.
hiedb = overrideCabal (old: {
libraryHaskellDepends = old.libraryHaskellDepends ++ [self.ghc-api-compat];
}) super.hiedb;
# 2021-09-18: https://github.com/haskell/haskell-language-server/issues/2206
# Restrictive upper bound on ormolu
hls-ormolu-plugin = doJailbreak super.hls-ormolu-plugin;
# Too strict bounds on base
# https://github.com/lspitzner/multistate/issues/9
multistate = doJailbreak super.multistate;
# https://github.com/lspitzner/butcher/issues/7
butcher = doJailbreak super.butcher;
# We use a GHC patch to support the fix for https://github.com/fpco/inline-c/issues/127
# which means that the upstream cabal file isn't allowed to add the flag.
inline-c-cpp =
(if isDarwin then appendConfigureFlags ["--ghc-option=-fcompact-unwind"] else x: x)
super.inline-c-cpp;
# 2022-05-31: weeder 2.3.0 requires GHC 9.2
weeder = doDistribute self.weeder_2_3_1;
}

View file

@ -0,0 +1,241 @@
{ pkgs, haskellLib }:
with haskellLib;
let
inherit (pkgs.stdenv.hostPlatform) isDarwin;
in
self: super: {
llvmPackages = pkgs.lib.dontRecurseIntoAttrs self.ghc.llvmPackages;
# Disable GHC 9.2.x core libraries.
array = null;
base = null;
binary = null;
bytestring = null;
Cabal = null;
containers = null;
deepseq = null;
directory = null;
exceptions = null;
filepath = null;
ghc-bignum = null;
ghc-boot = null;
ghc-boot-th = null;
ghc-compact = null;
ghc-heap = null;
ghc-prim = null;
ghci = null;
haskeline = null;
hpc = null;
integer-gmp = null;
libiserv = null;
mtl = null;
parsec = null;
pretty = null;
process = null;
rts = null;
stm = null;
template-haskell = null;
terminfo = null;
text = null;
time = null;
transformers = null;
unix = null;
# GHC only bundles the xhtml library if haddock is enabled, check if this is
# still the case when updating: https://gitlab.haskell.org/ghc/ghc/-/blob/0198841877f6f04269d6050892b98b5c3807ce4c/ghc.mk#L463
xhtml = if self.ghc.hasHaddock or true then null else self.xhtml_3000_2_2_1;
# Tests fail because of typechecking changes
conduit = dontCheck super.conduit;
# 0.30 introduced support for GHC 9.2.x, so when this assert fails, the whole block can be removed
cryptonite = assert super.cryptonite.version == "0.29"; appendPatch (pkgs.fetchpatch {
url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/dfd024c9a336c752288ec35879017a43bd7e85a0/patches/cryptonite-0.29.patch";
sha256 = "1g48lrmqgd88hqvfq3klz7lsrpwrir2v1931myrhh6dy0d9pqj09";
}) super.cryptonite;
# cabal-install needs more recent versions of Cabal
cabal-install = (doJailbreak super.cabal-install).overrideScope (self: super: {
Cabal = self.Cabal_3_6_3_0;
});
doctest = dontCheck (doJailbreak super.doctest);
# Tests fail in GHC 9.2
extra = dontCheck super.extra;
# Jailbreaks & Version Updates
# This `doJailbreak` can be removed once we have doctest v0.20
aeson-diff = assert super.doctest.version == "0.18.2"; doJailbreak super.aeson-diff;
assoc = doJailbreak super.assoc;
async = doJailbreak super.async;
base64-bytestring = doJailbreak super.base64-bytestring;
base-compat = self.base-compat_0_12_1;
base-compat-batteries = self.base-compat-batteries_0_12_1;
binary-instances = doJailbreak super.binary-instances;
ChasingBottoms = doJailbreak super.ChasingBottoms;
constraints = doJailbreak super.constraints;
cpphs = overrideCabal (drv: { postPatch = "sed -i -e 's,time >=1.5 && <1.11,time >=1.5 \\&\\& <1.12,' cpphs.cabal";}) super.cpphs;
data-fix = doJailbreak super.data-fix;
dbus = super.dbus_1_2_24;
dec = doJailbreak super.dec;
ed25519 = doJailbreak super.ed25519;
ghc-byteorder = doJailbreak super.ghc-byteorder;
ghc-exactprint = overrideCabal (drv: {
# HACK: ghc-exactprint 1.4.1 is not buildable for GHC < 9.2,
# but hackage2nix evaluates the cabal file with GHC 8.10.*,
# causing the build-depends to be skipped. Since the dependency
# list hasn't changed much since 0.6.4, we can just reuse the
# normal expression.
inherit (self.ghc-exactprint_1_5_0) src version;
revision = null; editedCabalFile = null;
libraryHaskellDepends = [
self.fail
self.ordered-containers
self.data-default
] ++ drv.libraryHaskellDepends or [];
}) super.ghc-exactprint;
ghc-lib = self.ghc-lib_9_2_3_20220527;
ghc-lib-parser = self.ghc-lib-parser_9_2_3_20220527;
ghc-lib-parser-ex = self.ghc-lib-parser-ex_9_2_0_4;
hackage-security = doJailbreak super.hackage-security;
hashable = super.hashable_1_4_0_2;
hashable-time = doJailbreak super.hashable-time;
# 1.1.1 introduced support for GHC 9.2.x, so when this assert fails, the jailbreak can be removed
hedgehog = assert super.hedgehog.version == "1.0.5"; doJailbreak super.hedgehog;
HTTP = overrideCabal (drv: { postPatch = "sed -i -e 's,! Socket,!Socket,' Network/TCP.hs"; }) (doJailbreak super.HTTP);
integer-logarithms = overrideCabal (drv: { postPatch = "sed -i -e 's, <1.1, <1.3,' integer-logarithms.cabal"; }) (doJailbreak super.integer-logarithms);
indexed-traversable = doJailbreak super.indexed-traversable;
indexed-traversable-instances = doJailbreak super.indexed-traversable-instances;
lifted-async = doJailbreak super.lifted-async;
lukko = doJailbreak super.lukko;
lzma-conduit = doJailbreak super.lzma-conduit;
ormolu = self.ormolu_0_5_0_0;
parallel = doJailbreak super.parallel;
path = doJailbreak super.path;
polyparse = overrideCabal (drv: { postPatch = "sed -i -e 's, <0.11, <0.12,' polyparse.cabal"; }) (doJailbreak super.polyparse);
primitive = doJailbreak super.primitive;
# https://github.com/protolude/protolude/pull/136
protolude = appendPatches [
(pkgs.fetchpatch {
url = "https://github.com/protolude/protolude/commit/47820a36c25ea6f0c6e44382f7d4f3507358b8e7.diff";
sha256 = "sha256-PtHx5SyTgqFzI03YVeQD+RqglO6ASMQWSxdpy4ROMDY=";
})
] (doJailbreak super.protolude);
regex-posix = doJailbreak super.regex-posix;
resolv = doJailbreak super.resolv;
retrie = doDistribute (dontCheck self.retrie_1_2_0_1);
singleton-bool = doJailbreak super.singleton-bool;
servant = doJailbreak super.servant;
servant-auth = doJailbreak super.servant-auth;
servant-server = appendPatches [
# awaiting release
(pkgs.fetchpatch {
url = "https://github.com/haskell-servant/servant/commit/61d0d14b5cb01db3d589101b3f17b0178f52e386.diff";
relative = "servant-server";
sha256 = "sha256-3lM8xLO8avVRo8oncJR8QLDSWEzOaoCmzgVtyaEBEw8=";
})
] (doJailbreak super.servant-server);
servant-swagger = doJailbreak super.servant-swagger;
servant-auth-swagger = doJailbreak super.servant-auth-swagger;
shelly = doJailbreak super.shelly;
splitmix = doJailbreak super.splitmix;
tasty-hspec = doJailbreak super.tasty-hspec;
th-desugar = self.th-desugar_1_13_1;
time-compat = doJailbreak super.time-compat;
tomland = doJailbreak super.tomland;
type-equality = doJailbreak super.type-equality;
unordered-containers = doJailbreak super.unordered-containers;
vector = dontCheck super.vector;
vector-binary-instances = doJailbreak super.vector-binary-instances;
hpack = overrideCabal (drv: {
# Cabal 3.6 seems to preserve comments when reading, which makes this test fail
# 2021-10-10: 9.2.1 is not yet supported (also no issue)
testFlags = [
"--skip=/Hpack/renderCabalFile/is inverse to readCabalFile/"
] ++ drv.testFlags or [];
}) (doJailbreak super.hpack);
validity = pkgs.lib.pipe super.validity [
# head.hackage patch
(appendPatch (pkgs.fetchpatch {
url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/9110e6972b5daf085e19cad41f97920d3ddac499/patches/validity-0.12.0.0.patch";
sha256 = "0hzns596dxvyn8irgi7aflx76wak1qi13chkkvl0055pkgykm08f";
}))
# head.hackage ignores test suite
dontCheck
];
# lens >= 5.1 supports 9.2.1
lens = doDistribute self.lens_5_1_1;
# Syntax error in tests fixed in https://github.com/simonmar/alex/commit/84b29475e057ef744f32a94bc0d3954b84160760
alex = dontCheck super.alex;
# Apply patches from head.hackage.
language-haskell-extract = appendPatch (pkgs.fetchpatch {
url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/dfd024c9a336c752288ec35879017a43bd7e85a0/patches/language-haskell-extract-0.2.4.patch";
sha256 = "0w4y3v69nd3yafpml4gr23l94bdhbmx8xky48a59lckmz5x9fgxv";
}) (doJailbreak super.language-haskell-extract);
# Tests depend on `parseTime` which is no longer available
hourglass = dontCheck super.hourglass;
# 0.17.0 introduced support for GHC 9.2.x, so when this assert fails, the whole block can be removed
memory = assert super.memory.version == "0.16.0"; appendPatch (pkgs.fetchpatch {
url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/dfd024c9a336c752288ec35879017a43bd7e85a0/patches/memory-0.16.0.patch";
sha256 = "1kjganx729a6xfgfnrb3z7q6mvnidl042zrsd9n5n5a3i76nl5nl";
}) (overrideCabal {
editedCabalFile = null;
revision = null;
} super.memory);
# Use hlint from git for GHC 9.2.1 support
hlint = self.hlint_3_4;
# https://github.com/sjakobi/bsb-http-chunked/issues/38
bsb-http-chunked = dontCheck super.bsb-http-chunked;
# need bytestring >= 0.11 which is only bundled with GHC >= 9.2
regex-rure = doDistribute (markUnbroken super.regex-rure);
jacinda = doDistribute super.jacinda;
some = doJailbreak super.some;
# 2022-06-05: this is not the latest version of fourmolu because
# hls-fourmolu-plugin 1.0.3.0 doesnt support a newer one.
fourmolu = super.fourmolu_0_6_0_0;
# hls-fourmolu-plugin in this version has a to strict upper bound of fourmolu <= 0.5.0.0
hls-fourmolu-plugin = assert super.hls-fourmolu-plugin.version == "1.0.3.0"; doJailbreak super.hls-fourmolu-plugin;
hls-ormolu-plugin = assert super.hls-ormolu-plugin.version == "1.0.2.1"; doJailbreak super.hls-ormolu-plugin;
implicit-hie-cradle = doJailbreak super.implicit-hie-cradle;
# 1.3 introduced support for GHC 9.2.x, so when this assert fails, the jailbreak can be removed
hashtables = assert super.hashtables.version == "1.2.4.2"; doJailbreak super.hashtables;
hiedb = doJailbreak super.hiedb;
# 2022-02-05: The following plugins dont work yet on ghc9.2.
# Compare: https://haskell-language-server.readthedocs.io/en/latest/supported-versions.html
haskell-language-server = overrideCabal (old: {libraryHaskellDepends = builtins.filter (x: x != super.hls-tactics-plugin) old.libraryHaskellDepends;})
(appendConfigureFlags [
"-f-haddockComments"
"-f-retrie"
"-f-splice"
"-f-tactics"
] (super.haskell-language-server.override {
hls-haddock-comments-plugin = null;
hls-hlint-plugin = null;
hls-retrie-plugin = null;
hls-splice-plugin = null;
}));
# https://github.com/fpco/inline-c/pull/131
inline-c-cpp =
(if isDarwin then appendConfigureFlags ["--ghc-option=-fcompact-unwind"] else x: x)
super.inline-c-cpp;
}

View file

@ -0,0 +1,89 @@
##
## Caveat: a copy of configuration-ghc-8.6.x.nix with minor changes:
##
## 1. "8.7" strings
## 2. llvm 6
## 3. disabled library update: parallel
##
{ pkgs, haskellLib }:
with haskellLib;
let
inherit (pkgs.stdenv.hostPlatform) isDarwin;
in
self: super: {
llvmPackages = pkgs.lib.dontRecurseIntoAttrs self.ghc.llvmPackages;
# Disable GHC core libraries.
array = null;
base = null;
binary = null;
bytestring = null;
Cabal = null;
Cabal-syntax = null;
containers = null;
deepseq = null;
directory = null;
exceptions = null;
filepath = null;
ghc-bignum = null;
ghc-boot = null;
ghc-boot-th = null;
ghc-compact = null;
ghc-heap = null;
ghc-prim = null;
ghci = null;
haskeline = null;
hpc = null;
integer-gmp = null;
libiserv = null;
mtl = null;
parsec = null;
pretty = null;
process = null;
rts = null;
stm = null;
template-haskell = null;
terminfo = null;
text = null;
time = null;
transformers = null;
unix = null;
# GHC only bundles the xhtml library if haddock is enabled, check if this is
# still the case when updating: https://gitlab.haskell.org/ghc/ghc/-/blob/0198841877f6f04269d6050892b98b5c3807ce4c/ghc.mk#L463
xhtml = if self.ghc.hasHaddock or true then null else self.xhtml_3000_2_2_1;
# https://github.com/tibbe/unordered-containers/issues/214
unordered-containers = dontCheck super.unordered-containers;
# Test suite does not compile.
data-clist = doJailbreak super.data-clist; # won't cope with QuickCheck 2.12.x
dates = doJailbreak super.dates; # base >=4.9 && <4.12
Diff = dontCheck super.Diff;
HaTeX = doJailbreak super.HaTeX; # containers >=0.4 && <0.6 is too tight; https://github.com/Daniel-Diaz/HaTeX/issues/126
hpc-coveralls = doJailbreak super.hpc-coveralls; # https://github.com/guillaume-nargeot/hpc-coveralls/issues/82
http-api-data = doJailbreak super.http-api-data;
persistent-sqlite = dontCheck super.persistent-sqlite;
system-fileio = dontCheck super.system-fileio; # avoid dependency on broken "patience"
unicode-transforms = dontCheck super.unicode-transforms;
wl-pprint-extras = doJailbreak super.wl-pprint-extras; # containers >=0.4 && <0.6 is too tight; https://github.com/ekmett/wl-pprint-extras/issues/17
RSA = dontCheck super.RSA; # https://github.com/GaloisInc/RSA/issues/14
monad-par = dontCheck super.monad-par; # https://github.com/simonmar/monad-par/issues/66
github = dontCheck super.github; # hspec upper bound exceeded; https://github.com/phadej/github/pull/341
binary-orphans = dontCheck super.binary-orphans; # tasty upper bound exceeded; https://github.com/phadej/binary-orphans/commit/8ce857226595dd520236ff4c51fa1a45d8387b33
# https://github.com/jgm/skylighting/issues/55
skylighting-core = dontCheck super.skylighting-core;
# Break out of "yaml >=0.10.4.0 && <0.11": https://github.com/commercialhaskell/stack/issues/4485
stack = doJailbreak super.stack;
# https://github.com/fpco/inline-c/pull/131
# and/or https://gitlab.haskell.org/ghc/ghc/-/merge_requests/7739
inline-c-cpp =
(if isDarwin then appendConfigureFlags ["--ghc-option=-fcompact-unwind"] else x: x)
super.inline-c-cpp;
}

View file

@ -0,0 +1,106 @@
# GHCJS package fixes
#
# Please insert new packages *alphabetically*
# in the OTHER PACKAGES section.
{ pkgs, haskellLib }:
let
removeLibraryHaskellDepends = pnames: depends:
builtins.filter (e: !(builtins.elem (e.pname or "") pnames)) depends;
in
with haskellLib;
self: super:
## GENERAL SETUP BASE PACKAGES
{
inherit (self.ghc.bootPkgs)
jailbreak-cabal alex happy gtk2hs-buildtools rehoo hoogle;
ghcjs-base = dontCheck (self.callPackage ../compilers/ghcjs/ghcjs-base.nix {
fetchFromGitHub = pkgs.buildPackages.fetchFromGitHub;
});
# GHCJS does not ship with the same core packages as GHC.
# https://github.com/ghcjs/ghcjs/issues/676
stm = doJailbreak self.stm_2_5_0_2;
exceptions = dontCheck self.exceptions_0_10_5;
## OTHER PACKAGES
# Runtime exception in tests, missing C API h$realloc
base-compat-batteries = dontCheck super.base-compat-batteries;
# nodejs crashes during test
ChasingBottoms = dontCheck super.ChasingBottoms;
# doctest doesn't work on ghcjs, but sometimes dontCheck doesn't seem to get rid of the dependency
doctest = pkgs.lib.warn "ignoring dependency on doctest" null;
ghcjs-dom = overrideCabal (drv: {
libraryHaskellDepends = with self; [
ghcjs-base ghcjs-dom-jsffi text transformers
];
configureFlags = [ "-fjsffi" "-f-webkit" ];
}) super.ghcjs-dom;
ghcjs-dom-jsffi = overrideCabal (drv: {
libraryHaskellDepends = (drv.libraryHaskellDepends or []) ++ [ self.ghcjs-base self.text ];
broken = false;
}) super.ghcjs-dom-jsffi;
# https://github.com/Deewiant/glob/issues/39
Glob = dontCheck super.Glob;
# Test fails to compile during the hsc2hs stage
hashable = dontCheck super.hashable;
# uses doctest
http-types = dontCheck super.http-types;
jsaddle = overrideCabal (drv: {
libraryHaskellDepends = (drv.libraryHaskellDepends or []) ++ [ self.ghcjs-base ];
}) super.jsaddle;
# Tests hang, possibly some issue with tasty and race(async) usage in the nonTerminating tests
logict = dontCheck super.logict;
patch = dontCheck super.patch;
# TODO: tests hang
pcre-light = dontCheck super.pcre-light;
# Terminal test not supported on ghcjs
QuickCheck = dontCheck super.QuickCheck;
reflex = overrideCabal (drv: {
libraryHaskellDepends = (drv.libraryHaskellDepends or []) ++ [ self.ghcjs-base ];
}) super.reflex;
reflex-dom = overrideCabal (drv: {
libraryHaskellDepends = removeLibraryHaskellDepends ["jsaddle-webkit2gtk"] (drv.libraryHaskellDepends or []);
}) super.reflex-dom;
# https://github.com/dreixel/syb/issues/21
syb = dontCheck super.syb;
# nodejs crashes during test
scientific = dontCheck super.scientific;
# Tests use TH which gives error
tasty-quickcheck = dontCheck super.tasty-quickcheck;
temporary = dontCheck super.temporary;
# 2 tests fail, related to time precision
time-compat = dontCheck super.time-compat;
# TODO: The tests have a TH error, which has been fixed in ghc
# https://gitlab.haskell.org/ghc/ghc/-/issues/15481 but somehow the issue is
# still present here https://github.com/glguy/th-abstraction/issues/53
th-abstraction = dontCheck super.th-abstraction;
# Need hedgehog for tests, which fails to compile due to dep on concurrent-output
zenc = dontCheck super.zenc;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,616 @@
# pkgs/development/haskell-modules/configuration-hackage2nix.yaml
compiler: ghc-9.0.2
core-packages:
- array-0.5.4.0
- base-4.15.1.0
- binary-0.8.8.0
- bytestring-0.10.12.1
- Cabal-3.4.1.0
- containers-0.6.4.1
- deepseq-1.4.5.0
- directory-1.3.6.2
- exceptions-0.10.4
- filepath-1.4.2.1
- ghc-9.0.2
- ghc-bignum-1.1
- ghc-boot-9.0.2
- ghc-boot-th-9.0.2
- ghc-compact-0.1.0.0
- ghc-heap-9.0.2
- ghc-prim-0.7.0
- ghci-9.0.2
- haskeline-0.8.2
- hpc-0.6.1.0
- integer-gmp-1.1
- libiserv-9.0.2
- mtl-2.2.2
- parsec-3.1.14.0
- pretty-1.1.3.6
- process-1.6.13.2
- rts-1.0.2
- stm-2.5.0.0
- template-haskell-2.17.0.0
- terminfo-0.4.1.5
- text-1.2.5.0
- time-1.9.3
- transformers-0.5.6.2
- unix-2.7.2.2
- xhtml-3000.2.2.1
# Hack: The following package is a core package of GHCJS. If we don't declare
# it, then hackage2nix will generate a Hackage database where all dependants
# of this library are marked as "broken".
- ghcjs-base-0
# This is a list of packages with versions from the latest Stackage LTS release.
#
# The packages and versions in this list cause the `hackage2nix` tool to
# generate the package at the given version.
#
# For instance, with a line like the following:
#
# - aeson ==1.4.6.0
#
# `hackage2nix` will generate the `aeson` package at version 1.4.6.0 in the
# ./hackage-packages.nix file.
#
# Since the packages in the LTS package set are sometimes older than the latest
# on Hackage, `hackage2nix` is smart enough to also generate the latest version
# of a given package.
#
# In the above example with aeson, if there was version 1.5.0.0 of aeson
# available on Hackage, `hackage2nix` would generate two packages, `aeson`
# at version 1.4.6.0 and `aeson_1_5_0_0` at version 1.5.0.0.
#
# WARNING: We import a list of default-package-overrides from stackage which is
# tracked in stackage.yaml. Adding conflicting overrides with stackage here will
# not work.
default-package-overrides:
# gi-gdkx11-4.x requires gtk-4.x, but stackage still restricts gi-gtk to 3.*
- gi-gdkx11 < 4
# reflex-dom-pandoc is only used by neuron which needs a version < 1.0.0.0
- reflex-dom-pandoc < 1.0.0.0
# 2022-02-18: pin to our current GHC version
- ghc-api-compat == 9.0.*
# 2021-11-09: ghc-bignum is bundled starting with 9.0.1; only 1.0 builds with GHCs prior to 9.2.1
- ghc-bignum == 1.0
# 1.2.0.0: “Dropped support for GHC <9.2 (might readd it later)”
- retrie < 1.2.0.0
# On the recommendation of hnix author:
# https://github.com/NixOS/nixpkgs/pull/154461#issuecomment-1015511883
- hnix < 0.15
# needs http-client >= 0.7.11 which isn't part of Stackage LTS 18
- http-client-restricted < 0.0.5
# Needs dhall 1.41.*, Stackage LTS 19 has 1.40
- dhall-nix < 1.1.24
# Temporarily forbid distribution-nixpkgs updates until cabal2nix supports the new version
- distribution-nixpkgs < 1.7.0
extra-packages:
- aeson < 2 # required by pantry-0.5.2
- base16-bytestring < 1 # required for cabal-install etc.
- Cabal == 2.2.* # required for jailbreak-cabal etc.
- Cabal == 2.4.* # required for cabal-install etc.
- Cabal == 3.2.* # required for cabal-install etc.
- Cabal == 3.4.* # required for cabal-install etc.
- dependent-map == 0.2.4.0 # required by Hasura 1.3.1, 2020-08-20
- dependent-sum == 0.4 # required by Hasura 1.3.1, 2020-08-20
- dhall == 1.29.0 # required for ats-pkg
- dhall == 1.38.1 # required for spago
- Diff < 0.4 # required by liquidhaskell-0.8.10.2: https://github.com/ucsd-progsys/liquidhaskell/issues/1729
- haddock == 2.23.* # required on GHC < 8.10.x
- haddock-api == 2.23.* # required on GHC < 8.10.x
- haddock-library ==1.7.* # required by stylish-cabal-0.5.0.0
- happy == 1.19.12 # for ghcjs
- hinotify == 0.3.9 # for xmonad-0.26: https://github.com/kolmodin/hinotify/issues/29
- immortal == 0.2.2.1 # required by Hasura 1.3.1, 2020-08-20
- language-javascript == 0.7.0.0 # required by purescript
- mmorph == 1.1.3 # Newest working version of mmorph on ghc 8.6.5. needed for hls
- network == 2.6.3.1 # required by pkgs/games/hedgewars/default.nix, 2020-11-15
- optparse-applicative < 0.16 # needed for niv-0.2.19
- pantry == 0.5.2.1 # needed for stack-2.7.3
- resolv == 0.1.1.2 # required to build cabal-install-3.0.0.0 with pre ghc-8.8.x
- sbv == 7.13 # required for pkgs.petrinizer
- crackNum < 3.0 # 2021-05-21: 3.0 removed the lib which sbv 7.13 uses
- ghc-api-compat == 8.6 # 2021-09-07: preserve for GHC 8.8.4
- ghc-api-compat == 8.10.7 # 2022-02-17: preserve for GHC 8.10.7
- ghc-lib == 8.10.7.* # 2022-02-17: preserve for GHC 8.10.7
- ghc-lib-parser == 8.10.7.* # 2022-02-17: preserve for GHC 8.10.7
- ghc-lib-parser-ex == 8.10.* # 2022-02-17: preserve for GHC 8.10.7
- doctest == 0.18.* # 2021-11-19: closest to stackage version for GHC 9.*
- path == 0.9.0 # 2021-12-03: path version building with stackage genvalidity and GHC 9.0.2
- ormolu == 0.2.* # 2022-02-21: For ghc 8.8 and 8.10
- ShellCheck == 0.7.2 # 2022-02-20: haskell-ci 0.14 needs this
- weeder == 2.2.* # 2022-02-21: preserve for GHC 8.10.7
- weeder == 2.3.* # 2022-05-31: preserve for GHC 9.0.2
- attoparsec == 0.13.* # 2022-02-23: Needed to compile elm for now
- relude == 0.7.0.0 # 2022-02-25: Needed for ema 0.6
- clay < 0.14 # 2022-03-20: Needed for neuron 1.0.0.0
- hspec-golden == 0.1.* # 2022-04-07: Needed for elm-format
- tasty-hspec == 1.1.6 # 2022-04-07: Needed for elm-format
- hspec < 2.8 # 2022-04-07: Needed for tasty-hspec 1.1.6
- hspec-core < 2.8 # 2022-04-07: Needed for tasty-hspec 1.1.6
- hspec-discover < 2.8 # 2022-04-07: Needed for tasty-hspec 1.1.6
- bower-json == 1.0.0.1 # 2022-05-21: Needed for spago 0.20.9
- fourmolu == 0.6.0.0 # 2022-06-05: Last fourmolu version compatible with hls 1.7/ hls-fourmolu-plugin 1.0.3.0
package-maintainers:
abbradar:
- Agda
Anton-Latukha:
- hnix
- hnix-store-core
- hnix-store-remote
berberman:
- nvfetcher
- arch-web
- uusi
bdesham:
- pinboard-notes-backup
cdepillabout:
- password
- password-instances
- pretty-simple
- purenix
- spago
- stack
- termonad
dalpd:
- ghc-vis
- svgcairo
domenkozar:
- cachix
- cachix-api
dschrempf:
- circular
- covariance
- dirichlet
- elynx
- elynx-markov
- elynx-nexus
- elynx-seq
- elynx-tools
- elynx-tree
- glasso
- mcmc
- pava
- slynx
- tlynx
expipiplus1:
- VulkanMemoryAllocator
- autoapply
- exact-real
- language-c
- orbits
- update-nix-fetchgit
- vector-sized
- vulkan
- vulkan-utils
erictapen:
- hakyll
- hakyll-contrib-hyphenation
- webify
- squeal-postgresql
Gabriel439:
- annah
- bench
- break
- dhall-bash
- dhall-docs
- dhall-json
- dhall-lsp-server
- dhall-nix
- dhall-nixpkgs
- dhall-openapi
- dhall-text
- dhall-yaml
- dhall
- dirstream
- errors
- foldl
- index-core
- lens-tutorial
- list-transformer
- managed
- mmorph
- morte
- mvc-updates
- mvc
- nix-derivation
- nix-diff
- optional-args
- optparse-generic
- pipes-bytestring
- pipes-concurrency
- pipes-csv
- pipes-extras
- pipes-group
- pipes-http
- pipes-parse
- pipes-safe
- pipes
- server-generic
- total
- turtle
- typed-spreadsheet
gebner:
- wstunnel
gridaphobe:
- located-base
jb55:
# - bson-lens
- cased
- elm-export-persistent
# - pipes-mongodb
- streaming-wai
kiwi:
- config-schema
- config-value
- glirc
- irc-core
- matterhorn
- mattermost-api
- mattermost-api-qc
- Unique
libjared:
- sensei
maralorn:
- cabal-fmt
- ema
- generic-optics
- ghcid
- ghcide
- haskell-language-server
- hedgehog
- hlint
- hmatrix
- hspec-discover
- iCalendar
- matrix-client
- neuron
- optics
- paths
- postgresql-simple
- reflex-dom
- releaser
- replace-megaparsec
- req
- shake-bench
- shh
- shh-extras
- snap
- stm-containers
- streamly
- taskwarrior
- tz
- weeder
- witch
ncfavier:
- lambdabot
nomeata:
- candid
- leb128-cereal
- tasty-expected-failure
- lhs2tex
pacien:
- ldgallery-compiler
peti:
- cabal-install
- cabal2nix
- cabal2spec
- distribution-nixpkgs
- funcmp
- git-annex
- hackage-db
- hledger
- hledger-interest
- hledger-ui
- hledger-web
- hopenssl
- hsdns
- hsemail
- hsyslog
- jailbreak-cabal
- language-nix
- logging-facade-syslog
- nix-paths
- pandoc
- structured-haskell-mode
- titlecase
- xmonad
- xmonad-contrib
poscat:
- hinit
psibi:
- path-pieces
- persistent
- persistent-sqlite
- persistent-template
- shakespeare
roberth:
- arion-compose
- cabal-pkg-config-version-hook
- hercules-ci-agent
- hercules-ci-api
- hercules-ci-api-agent
- hercules-ci-api-core
- hercules-ci-cli
- hercules-ci-cnix-expr
- hercules-ci-cnix-store
- inline-c
- inline-c-cpp
rvl:
- taffybar
- arbtt
- lentil
sorki:
- cayenne-lpp
- data-stm32
- gcodehs
- nix-derivation
- nix-narinfo
- ttn
- ttn-client
- update-nix-fetchgit
- zre
sternenseemann:
# also maintain upstream package
- spacecookie
- gopher-proxy
# other packages I can help out for
- systemd
- fast-logger
- flat
- Euterpea2
- utc
- socket
- gitit
- yarn-lock
- yarn2nix
- large-hashable
- haskell-ci
- diagrams
- rel8
- regex-rure
- jacinda
# owothia
- irc-client
- chatter
- envy
terlar:
- nix-diff
turion:
- rhine
- rhine-gloss
- essence-of-live-coding
- essence-of-live-coding-gloss
- essence-of-live-coding-pulse
- essence-of-live-coding-quickcheck
- Agda
- dunai
- finite-typelits
- pulse-simple
- simple-affine-space
utdemir:
- nix-tree
unsupported-platforms:
Allure: [ x86_64-darwin, aarch64-darwin ]
alsa-mixer: [ x86_64-darwin, aarch64-darwin ]
alsa-pcm: [ x86_64-darwin, aarch64-darwin ]
alsa-seq: [ x86_64-darwin, aarch64-darwin ]
AWin32Console: [ i686-linux, x86_64-linux, x86_64-darwin, aarch64-darwin, aarch64-linux, armv7l-linux ]
barbly: [ i686-linux, x86_64-linux, aarch64-linux, armv7l-linux ]
bdcs-api: [ x86_64-darwin, aarch64-darwin ]
bindings-directfb: [ x86_64-darwin, aarch64-darwin ]
bindings-parport: [ x86_64-darwin, aarch64-darwin ] # parport is a linux kernel component
bindings-sane: [ x86_64-darwin, aarch64-darwin ]
btrfs: [ x86_64-darwin, aarch64-darwin ] # depends on linux
bustle: [ x86_64-darwin, aarch64-darwin ] # uses glibc-specific ptsname_r
camfort: [ aarch64-linux ]
charsetdetect: [ aarch64-linux ] # not supported by vendored lib / not configured properly https://github.com/batterseapower/libcharsetdetect/issues/3
cut-the-crap: [ x86_64-darwin, aarch64-darwin ]
d3d11binding: [ i686-linux, x86_64-linux, x86_64-darwin, aarch64-darwin, aarch64-linux, armv7l-linux ]
DirectSound: [ i686-linux, x86_64-linux, x86_64-darwin, aarch64-darwin, aarch64-linux, armv7l-linux ]
dx9base: [ i686-linux, x86_64-linux, x86_64-darwin, aarch64-darwin, aarch64-linux, armv7l-linux ]
dx9d3d: [ i686-linux, x86_64-linux, x86_64-darwin, aarch64-darwin, aarch64-linux, armv7l-linux ]
dx9d3dx: [ i686-linux, x86_64-linux, x86_64-darwin, aarch64-darwin, aarch64-linux, armv7l-linux ]
Euterpea: [ x86_64-darwin, aarch64-darwin ]
essence-of-live-coding-PortMidi: [ x86_64-darwin, aarch64-darwin ]
follow-file: [ x86_64-darwin, aarch64-darwin ]
freenect: [ x86_64-darwin, aarch64-darwin ]
FTGL: [ x86_64-darwin, aarch64-darwin ]
fuzzytime: [ x86_64-darwin, aarch64-darwin ] # https://github.com/kamwitsta/fuzzytime/issues/2
ghcjs-dom-hello: [ x86_64-darwin, aarch64-darwin ]
gi-adwaita: [ x86_64-darwin, aarch64-darwin ]
gi-dbusmenugtk3: [ x86_64-darwin, aarch64-darwin ]
gi-dbusmenu: [ x86_64-darwin, aarch64-darwin ]
gi-ggit: [ x86_64-darwin, aarch64-darwin ]
gi-gtkosxapplication: [ x86_64-linux, aarch64-linux ]
gi-ibus: [ x86_64-darwin, aarch64-darwin ]
gi-javascriptcore: [ x86_64-darwin, aarch64-darwin ] # webkitgtk marked broken on darwin
gi-ostree: [ x86_64-darwin, aarch64-darwin ]
gi-vte: [ x86_64-darwin, aarch64-darwin ]
gi-webkit2webextension: [ x86_64-darwin, aarch64-darwin ] # webkitgtk marked broken on darwin
gi-webkit2: [ x86_64-darwin, aarch64-darwin ] # webkitgtk marked broken on darwin
gi-wnck: [ x86_64-darwin, aarch64-darwin ]
gnome-keyring: [ x86_64-darwin, aarch64-darwin ]
grid-proto: [ x86_64-darwin, aarch64-darwin ]
gtk3-mac-integration: [ x86_64-linux, aarch64-linux ]
gtk-mac-integration: [ i686-linux, x86_64-linux, aarch64-linux, armv7l-linux ]
gtk-sni-tray: [ x86_64-darwin, aarch64-darwin ]
haskell-snake: [ x86_64-darwin, aarch64-darwin ]
hbro-contrib: [ x86_64-darwin, aarch64-darwin ] # webkitgtk marked broken on darwin
hbro: [ x86_64-darwin, aarch64-darwin ] # webkitgtk marked broken on darwin
hcwiid: [ x86_64-darwin, aarch64-darwin ]
HDRUtils: [ x86_64-darwin, aarch64-darwin ]
HFuse: [ x86_64-darwin, aarch64-darwin ]
hidapi: [ x86_64-darwin, aarch64-darwin ]
hinotify-bytestring: [ x86_64-darwin, aarch64-darwin ]
hommage-ds: [ i686-linux, x86_64-linux, x86_64-darwin, aarch64-darwin, aarch64-linux, armv7l-linux ]
honk: [ x86_64-darwin, aarch64-darwin ]
hpapi: [ x86_64-darwin, aarch64-darwin ]
HQu: [ aarch64-linux, armv7l-linux ] # unsupported by vendored C++ library, TODO: explicitly list supported platforms
HSoM: [ x86_64-darwin, aarch64-darwin ]
iwlib: [ x86_64-darwin, aarch64-darwin ]
Jazzkell: [ x86_64-darwin, aarch64-darwin ] # depends on Euterpea
jsaddle-webkit2gtk: [ x86_64-darwin, aarch64-darwin ]
keid-core: [ aarch64-linux ]
keid-geometry: [ aarch64-linux ]
keid-render-basic: [ aarch64-linux ]
keid-sound-openal: [ aarch64-linux ]
keid-ui-dearimgui: [ aarch64-linux ]
kqueue: [ x86_64-linux, aarch64-linux, i686-linux, armv7l-linux ] # BSD / Darwin only API
Kulitta: [ x86_64-darwin, aarch64-darwin ] # depends on Euterpea
LambdaHack: [ x86_64-darwin, aarch64-darwin ]
large-hashable: [ aarch64-linux ] # https://github.com/factisresearch/large-hashable/issues/17
libmodbus: [ x86_64-darwin, aarch64-darwin ]
libsystemd-journal: [ x86_64-darwin, aarch64-darwin ]
libtelnet: [ x86_64-darwin, aarch64-darwin ]
libvirt-hs: [ x86_64-darwin ] # spidermonkey is not supported on darwin
libzfs: [ x86_64-darwin, aarch64-darwin ]
linearEqSolver: [ aarch64-linux ]
linux-evdev: [ x86_64-darwin, aarch64-darwin ]
linux-file-extents: [ x86_64-darwin, aarch64-darwin ]
linux-inotify: [ x86_64-darwin, aarch64-darwin ]
linux-mount: [ x86_64-darwin, aarch64-darwin ]
linux-namespaces: [ x86_64-darwin, aarch64-darwin ]
lio-fs: [ x86_64-darwin, aarch64-darwin ]
logging-facade-journald: [ x86_64-darwin, aarch64-darwin ]
longshot: [ aarch64-linux ]
lxc: [ x86_64-darwin, aarch64-darwin ]
midi-alsa: [ x86_64-darwin, aarch64-darwin ]
mpi-hs: [ aarch64-linux, x86_64-darwin, aarch64-darwin ]
mpi-hs-binary: [ aarch64-linux, x86_64-darwin, aarch64-darwin ]
mpi-hs-cereal: [ aarch64-linux, x86_64-darwin, aarch64-darwin ]
mpi-hs-store: [ aarch64-linux, x86_64-darwin, aarch64-darwin ]
mplayer-spot: [ aarch64-linux ]
mptcp-pm: [ x86_64-darwin, aarch64-darwin ]
netlink: [ x86_64-darwin, aarch64-darwin ]
notifications-tray-icon: [ x86_64-darwin, aarch64-darwin ] # depends on gi-dbusmenu
oculus: [ x86_64-darwin, aarch64-darwin ]
pam: [ x86_64-darwin, aarch64-darwin ]
parport: [ x86_64-darwin, aarch64-darwin ]
password: [ aarch64-linux, armv7l-linux ] # uses scrypt, which requries x86
password-instances: [ aarch64-linux, armv7l-linux ] # uses scrypt, which requries x86
persist-state: [ aarch64-linux, armv7l-linux ] # https://github.com/minad/persist-state/blob/6fd68c0b8b93dec78218f6d5a1f4fa06ced4e896/src/Data/PersistState.hs#L122-L128
piyo: [ x86_64-darwin, aarch64-darwin ]
PortMidi-simple: [ x86_64-darwin, aarch64-darwin ]
PortMidi: [ x86_64-darwin, aarch64-darwin ]
posix-api: [ x86_64-darwin, aarch64-darwin ]
Raincat: [ x86_64-darwin, aarch64-darwin ]
reactive-balsa: [ x86_64-darwin, aarch64-darwin ] # depends on alsa-core
reactivity: [ i686-linux, x86_64-linux, x86_64-darwin, aarch64-darwin, aarch64-linux, armv7l-linux ]
reflex-dom-fragment-shader-canvas: [ x86_64-darwin, aarch64-darwin, aarch64-linux ]
reflex-dom: [ x86_64-darwin, aarch64-darwin, aarch64-linux ]
reflex-localize-dom: [ x86_64-darwin, aarch64-darwin, aarch64-linux ]
rtlsdr: [ x86_64-darwin, aarch64-darwin ]
rubberband: [ x86_64-darwin, aarch64-darwin ]
scat: [ aarch64-linux, armv7l-linux ] # uses scrypt, which requries x86
scrypt: [ aarch64-linux, armv7l-linux ] # https://github.com/informatikr/scrypt/issues/8
sdl2-mixer: [ x86_64-darwin, aarch64-darwin ]
sdl2-ttf: [ x86_64-darwin, aarch64-darwin ]
sensei: [ x86_64-darwin ]
synthesizer-alsa: [ x86_64-darwin, aarch64-darwin ]
taffybar: [ x86_64-darwin, aarch64-darwin ]
termonad: [ x86_64-darwin, aarch64-darwin ]
tokyotyrant-haskell: [ x86_64-darwin, aarch64-darwin ]
udev: [ x86_64-darwin, aarch64-darwin ]
Unixutils-shadow: [ x86_64-darwin, aarch64-darwin ]
verifiable-expressions: [ aarch64-linux ]
vrpn: [ x86_64-darwin, aarch64-darwin ]
vulkan: [ i686-linux, armv7l-linux, x86_64-darwin, aarch64-darwin ]
VulkanMemoryAllocator: [ i686-linux, armv7l-linux, x86_64-darwin, aarch64-darwin ]
vulkan-utils: [ x86_64-darwin, aarch64-darwin ]
webkit2gtk3-javascriptcore: [ x86_64-darwin, aarch64-darwin ]
Win32-console: [ i686-linux, x86_64-linux, x86_64-darwin, aarch64-darwin, aarch64-linux, armv7l-linux ]
Win32-dhcp-server: [ i686-linux, x86_64-linux, x86_64-darwin, aarch64-darwin, aarch64-linux, armv7l-linux ]
Win32-errors: [ i686-linux, x86_64-linux, x86_64-darwin, aarch64-darwin, aarch64-linux, armv7l-linux ]
Win32-extras: [ i686-linux, x86_64-linux, x86_64-darwin, aarch64-darwin, aarch64-linux, armv7l-linux ]
Win32: [ i686-linux, x86_64-linux, x86_64-darwin, aarch64-darwin, aarch64-linux, armv7l-linux ]
Win32-junction-point: [ i686-linux, x86_64-linux, x86_64-darwin, aarch64-darwin, aarch64-linux, armv7l-linux ]
Win32-notify: [ i686-linux, x86_64-linux, x86_64-darwin, aarch64-darwin, aarch64-linux, armv7l-linux ]
Win32-security: [ i686-linux, x86_64-linux, x86_64-darwin, aarch64-darwin, aarch64-linux, armv7l-linux ]
Win32-services: [ i686-linux, x86_64-linux, x86_64-darwin, aarch64-darwin, aarch64-linux, armv7l-linux ]
Win32-services-wrapper: [ i686-linux, x86_64-linux, x86_64-darwin, aarch64-darwin, aarch64-linux, armv7l-linux ]
xattr: [ x86_64-darwin, aarch64-darwin ]
xgboost-haskell: [ aarch64-linux, armv7l-linux ]
XInput: [ i686-linux, x86_64-linux, x86_64-darwin, aarch64-darwin, aarch64-linux, armv7l-linux ]
xmobar: [ x86_64-darwin, aarch64-darwin ]
xmonad-extras: [ x86_64-darwin, aarch64-darwin ]
xmonad-volume: [ x86_64-darwin, aarch64-darwin ]
dont-distribute-packages:
# Depends on shine, which is a ghcjs project.
- shine-varying
# these packages depend on software with an unfree license
- accelerate-bignum
- accelerate-blas
- accelerate-cublas
- accelerate-cuda
- accelerate-cufft
- accelerate-examples
- accelerate-fft
- accelerate-fourier-benchmark
- accelerate-io-array
- accelerate-io-bmp
- accelerate-io-bytestring
- accelerate-io-cereal
- accelerate-io-JuicyPixels
- accelerate-io-repa
- accelerate-io-vector
- accelerate-kullback-liebler
- accelerate-llvm-ptx
- bindings-yices
- boolector
- ccelerate-cuda
- containers-accelerate
- cplex-hs
- cublas
- cuda # 2020-08-18 because of dependency nvidia-x11
- cufft
- cusolver
- cusparse
- gloss-raster-accelerate
- hashable-accelerate
- libnvvm
- matlab
- nvvm
- Obsidian
- odpic-raw
- patch-image
# license for input data unclear, dependency not on Hackage
# see https://github.com/NixOS/nixpkgs/pull/88604
- tensorflow-mnist
- yices-easy
- yices-painless
# These packages dont build because they use deprecated webkit versions.
- diagrams-hsqml
- dialog
- ghcjs-dom-webkit
- gi-webkit
- hsqml
- hsqml-datamodel
- hsqml-demo-manic
- hsqml-demo-notes
- hsqml-demo-samples
- hstorchat
- jsaddle-webkitgtk
- jsc
- lambdacat
- manatee-all
- manatee-browser
- manatee-reader
- markup-preview
- spike
- web-browser-in-haskell
- webkit
- webkitgtk3-javascriptcore
- websnap
# mesos was removed from nixpkgs
- hs-mesos

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,38 @@
{ pkgs, haskellLib }:
with haskellLib;
self: super:
let
# This contains updates to the dependencies, without which it would
# be even more work to get it to build.
# As of 2020-04, there's no new release in sight, which is why we're
# pulling from Github.
tensorflow-haskell = pkgs.fetchFromGitHub {
owner = "tensorflow";
repo = "haskell";
rev = "568c9b6f03e5d66a25685a776386e2ff50b61aa9";
sha256 = "0v58zhqipa441hzdvp9pwgv6srir2fm7cp0bq2pb5jl1imwyd37h";
fetchSubmodules = true;
};
setTensorflowSourceRoot = dir: drv:
(overrideCabal (drv: { src = tensorflow-haskell; }) drv)
.overrideAttrs (_oldAttrs: {sourceRoot = "source/${dir}";});
in
{
tensorflow-proto = doJailbreak (setTensorflowSourceRoot "tensorflow-proto" super.tensorflow-proto);
tensorflow = (setTensorflowSourceRoot "tensorflow" super.tensorflow).override {
# the "regular" Python package does not seem to include the binary library
libtensorflow = pkgs.libtensorflow-bin;
};
tensorflow-core-ops = setTensorflowSourceRoot "tensorflow-core-ops" super.tensorflow-core-ops;
tensorflow-logging = setTensorflowSourceRoot "tensorflow-logging" super.tensorflow-logging;
tensorflow-opgen = setTensorflowSourceRoot "tensorflow-opgen" super.tensorflow-opgen;
tensorflow-ops = setTensorflowSourceRoot "tensorflow-ops" super.tensorflow-ops;
}

View file

@ -0,0 +1,45 @@
{ pkgs, stdenv, lib, haskellLib, ghc, all-cabal-hashes
, buildHaskellPackages
, compilerConfig ? (self: super: {})
, packageSetConfig ? (self: super: {})
, overrides ? (self: super: {})
, initialPackages ? import ./initial-packages.nix
, nonHackagePackages ? import ./non-hackage-packages.nix
, configurationCommon ? import ./configuration-common.nix
, configurationNix ? import ./configuration-nix.nix
, configurationArm ? import ./configuration-arm.nix
, configurationDarwin ? import ./configuration-darwin.nix
}:
let
inherit (lib) extends makeExtensible;
inherit (haskellLib) makePackageSet;
haskellPackages = pkgs.callPackage makePackageSet {
package-set = initialPackages;
inherit stdenv haskellLib ghc buildHaskellPackages extensible-self all-cabal-hashes;
};
isArm = with stdenv.hostPlatform; isAarch64 || isAarch32;
platformConfigurations = lib.optionals isArm [
(configurationArm { inherit pkgs haskellLib; })
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
(configurationDarwin { inherit pkgs haskellLib; })
];
extensions = lib.composeManyExtensions ([
nonHackagePackages
(configurationNix { inherit pkgs haskellLib; })
(configurationCommon { inherit pkgs haskellLib; })
] ++ platformConfigurations ++ [
compilerConfig
packageSetConfig
overrides
]);
extensible-self = makeExtensible (extends extensions haskellPackages);
in
extensible-self

View file

@ -0,0 +1,710 @@
{ lib, stdenv, buildPackages, buildHaskellPackages, ghc
, jailbreak-cabal, hscolour, cpphs, nodejs
, ghcWithHoogle, ghcWithPackages
}:
let
isCross = stdenv.buildPlatform != stdenv.hostPlatform;
inherit (buildPackages)
fetchurl removeReferencesTo
pkg-config coreutils gnugrep gnused glibcLocales;
in
{ pname
, dontStrip ? (ghc.isGhcjs or false)
, version, revision ? null
, sha256 ? null
, src ? fetchurl { url = "mirror://hackage/${pname}-${version}.tar.gz"; inherit sha256; }
, buildDepends ? [], setupHaskellDepends ? [], libraryHaskellDepends ? [], executableHaskellDepends ? []
, buildTarget ? ""
, buildTools ? [], libraryToolDepends ? [], executableToolDepends ? [], testToolDepends ? [], benchmarkToolDepends ? []
, configureFlags ? []
, buildFlags ? []
, haddockFlags ? []
, description ? null
, doCheck ? !isCross && lib.versionOlder "7.4" ghc.version
, doBenchmark ? false
, doHoogle ? true
, doHaddockQuickjump ? doHoogle && lib.versionAtLeast ghc.version "8.6"
, editedCabalFile ? null
# aarch64 outputs otherwise exceed 2GB limit
, enableLibraryProfiling ? !(ghc.isGhcjs or stdenv.targetPlatform.isAarch64 or false)
, enableExecutableProfiling ? false
, profilingDetail ? "exported-functions"
# TODO enable shared libs for cross-compiling
, enableSharedExecutables ? false
, enableSharedLibraries ? !stdenv.hostPlatform.isStatic && (ghc.enableShared or false)
, enableDeadCodeElimination ? (!stdenv.isDarwin) # TODO: use -dead_strip for darwin
, enableStaticLibraries ? !(stdenv.hostPlatform.isWindows or stdenv.hostPlatform.isWasm)
, enableHsc2hsViaAsm ? stdenv.hostPlatform.isWindows && lib.versionAtLeast ghc.version "8.4"
, extraLibraries ? [], librarySystemDepends ? [], executableSystemDepends ? []
# On macOS, statically linking against system frameworks is not supported;
# see https://developer.apple.com/library/content/qa/qa1118/_index.html
# They must be propagated to the environment of any executable linking with the library
, libraryFrameworkDepends ? [], executableFrameworkDepends ? []
, homepage ? "https://hackage.haskell.org/package/${pname}"
, platforms ? with lib.platforms; all # GHC can cross-compile
, badPlatforms ? lib.platforms.none
, hydraPlatforms ? null
, hyperlinkSource ? true
, isExecutable ? false, isLibrary ? !isExecutable
, jailbreak ? false
, license
, enableParallelBuilding ? true
, maintainers ? null
, changelog ? null
, mainProgram ? null
, doCoverage ? false
, doHaddock ? !(ghc.isHaLVM or false) && (ghc.hasHaddock or true)
, doHaddockInterfaces ? doHaddock && lib.versionAtLeast ghc.version "9.0.1"
, passthru ? {}
, pkg-configDepends ? [], libraryPkgconfigDepends ? [], executablePkgconfigDepends ? [], testPkgconfigDepends ? [], benchmarkPkgconfigDepends ? []
, testDepends ? [], testHaskellDepends ? [], testSystemDepends ? [], testFrameworkDepends ? []
, benchmarkDepends ? [], benchmarkHaskellDepends ? [], benchmarkSystemDepends ? [], benchmarkFrameworkDepends ? []
, testTarget ? "", testFlags ? []
, broken ? false
, preCompileBuildDriver ? null, postCompileBuildDriver ? null
, preUnpack ? null, postUnpack ? null
, patches ? null, patchPhase ? null, prePatch ? "", postPatch ? ""
, preConfigure ? null, postConfigure ? null
, preBuild ? null, postBuild ? null
, preHaddock ? null, postHaddock ? null
, installPhase ? null, preInstall ? null, postInstall ? null
, checkPhase ? null, preCheck ? null, postCheck ? null
, preFixup ? null, postFixup ? null
, shellHook ? ""
, coreSetup ? false # Use only core packages to build Setup.hs.
, useCpphs ? false
, hardeningDisable ? null
, enableSeparateBinOutput ? false
, enableSeparateDataOutput ? false
, enableSeparateDocOutput ? doHaddock
, # Don't fail at configure time if there are multiple versions of the
# same package in the (recursive) dependencies of the package being
# built. Will delay failures, if any, to compile time.
allowInconsistentDependencies ? false
, maxBuildCores ? 16 # more cores usually don't improve performance: https://ghc.haskell.org/trac/ghc/ticket/9221
, # If set to true, this builds a pre-linked .o file for this Haskell library.
# This can make it slightly faster to load this library into GHCi, but takes
# extra disk space and compile time.
enableLibraryForGhci ? false
} @ args:
assert editedCabalFile != null -> revision != null;
# --enable-static does not work on windows. This is a bug in GHC.
# --enable-static will pass -staticlib to ghc, which only works for mach-o and elf.
assert stdenv.hostPlatform.isWindows -> enableStaticLibraries == false;
assert stdenv.hostPlatform.isWasm -> enableStaticLibraries == false;
let
inherit (lib) optional optionals optionalString versionOlder versionAtLeast
concatStringsSep enableFeature optionalAttrs;
isGhcjs = ghc.isGhcjs or false;
isHaLVM = ghc.isHaLVM or false;
packageDbFlag = if isGhcjs || isHaLVM || versionOlder "7.6" ghc.version
then "package-db"
else "package-conf";
# GHC used for building Setup.hs
#
# Same as our GHC, unless we're cross, in which case it is native GHC with the
# same version, or ghcjs, in which case its the ghc used to build ghcjs.
nativeGhc = buildHaskellPackages.ghc;
nativePackageDbFlag = if versionOlder "7.6" nativeGhc.version
then "package-db"
else "package-conf";
# the target dir for haddock documentation
docdir = docoutput: docoutput + "/share/doc/" + pname + "-" + version;
binDir = if enableSeparateBinOutput then "$bin/bin" else "$out/bin";
newCabalFileUrl = "mirror://hackage/${pname}-${version}/revision/${revision}.cabal";
newCabalFile = fetchurl {
url = newCabalFileUrl;
sha256 = editedCabalFile;
name = "${pname}-${version}-r${revision}.cabal";
};
defaultSetupHs = builtins.toFile "Setup.hs" ''
import Distribution.Simple
main = defaultMain
'';
# This awk expression transforms a package conf file like
#
# author: John Doe <john-doe@example.com>
# description:
# The purpose of this library is to do
# foo and bar among other things
#
# into a more easily processeable form:
#
# author: John Doe <john-doe@example.com>
# description: The purpose of this library is to do foo and bar among other things
unprettyConf = builtins.toFile "unpretty-cabal-conf.awk" ''
/^[^ ]+:/ {
# When the line starts with a new field, terminate the previous one with a newline
if (started == 1) print ""
# to strip leading spaces
$1=$1
printf "%s", $0
started=1
}
/^ +/ {
# to strip leading spaces
$1=$1
printf " %s", $0
}
# Terminate the final field with a newline
END { print "" }
'';
crossCabalFlags = [
"--with-ghc=${ghcCommand}"
"--with-ghc-pkg=${ghc.targetPrefix}ghc-pkg"
# Pass the "wrong" C compiler rather than none at all so packages that just
# use the C preproccessor still work, see
# https://github.com/haskell/cabal/issues/6466 for details.
"--with-gcc=${(if stdenv.hasCC then stdenv else buildPackages.stdenv).cc.targetPrefix}cc"
] ++ optionals stdenv.hasCC [
"--with-ld=${stdenv.cc.bintools.targetPrefix}ld"
"--with-ar=${stdenv.cc.bintools.targetPrefix}ar"
# use the one that comes with the cross compiler.
"--with-hsc2hs=${ghc.targetPrefix}hsc2hs"
"--with-strip=${stdenv.cc.bintools.targetPrefix}strip"
] ++ optionals (!isHaLVM) [
"--hsc2hs-option=--cross-compile"
(optionalString enableHsc2hsViaAsm "--hsc2hs-option=--via-asm")
] ++ optional (allPkgconfigDepends != [])
"--with-pkg-config=${pkg-config.targetPrefix}pkg-config";
parallelBuildingFlags = "-j$NIX_BUILD_CORES" + optionalString stdenv.isLinux " +RTS -A64M -RTS";
crossCabalFlagsString =
lib.optionalString isCross (" " + lib.concatStringsSep " " crossCabalFlags);
buildFlagsString = optionalString (buildFlags != []) (" " + concatStringsSep " " buildFlags);
defaultConfigureFlags = [
"--verbose"
"--prefix=$out"
"--libdir=\\$prefix/lib/\\$compiler"
"--libsubdir=\\$abi/\\$libname"
(optionalString enableSeparateDataOutput "--datadir=$data/share/${ghcNameWithPrefix}")
(optionalString enableSeparateDocOutput "--docdir=${docdir "$doc"}")
] ++ optionals stdenv.hasCC [
"--with-gcc=$CC" # Clang won't work without that extra information.
] ++ [
"--package-db=$packageConfDir"
(optionalString (enableSharedExecutables && stdenv.isLinux) "--ghc-option=-optl=-Wl,-rpath=$out/lib/${ghcNameWithPrefix}/${pname}-${version}")
(optionalString (enableSharedExecutables && stdenv.isDarwin) "--ghc-option=-optl=-Wl,-headerpad_max_install_names")
(optionalString enableParallelBuilding "--ghc-options=${parallelBuildingFlags}")
(optionalString useCpphs "--with-cpphs=${cpphs}/bin/cpphs --ghc-options=-cpp --ghc-options=-pgmP${cpphs}/bin/cpphs --ghc-options=-optP--cpp")
(enableFeature (enableDeadCodeElimination && !stdenv.hostPlatform.isAarch32 && !stdenv.hostPlatform.isAarch64 && (versionAtLeast "8.0.1" ghc.version)) "split-objs")
(enableFeature enableLibraryProfiling "library-profiling")
(optionalString ((enableExecutableProfiling || enableLibraryProfiling) && versionOlder "8" ghc.version) "--profiling-detail=${profilingDetail}")
(enableFeature enableExecutableProfiling (if versionOlder ghc.version "8" then "executable-profiling" else "profiling"))
(enableFeature enableSharedLibraries "shared")
(optionalString (versionAtLeast ghc.version "7.10") (enableFeature doCoverage "coverage"))
(optionalString (versionOlder "8.4" ghc.version) (enableFeature enableStaticLibraries "static"))
(optionalString (isGhcjs || versionOlder "7.4" ghc.version) (enableFeature enableSharedExecutables "executable-dynamic"))
(optionalString (isGhcjs || versionOlder "7" ghc.version) (enableFeature doCheck "tests"))
(enableFeature doBenchmark "benchmarks")
"--enable-library-vanilla" # TODO: Should this be configurable?
(enableFeature enableLibraryForGhci "library-for-ghci")
] ++ optionals (enableDeadCodeElimination && (lib.versionOlder "8.0.1" ghc.version)) [
"--ghc-option=-split-sections"
] ++ optionals dontStrip [
"--disable-library-stripping"
"--disable-executable-stripping"
] ++ optionals isGhcjs [
"--ghcjs"
] ++ optionals isCross ([
"--configure-option=--host=${stdenv.hostPlatform.config}"
] ++ crossCabalFlags
) ++ optionals enableSeparateBinOutput [
"--bindir=${binDir}"
] ++ optionals (doHaddockInterfaces && isLibrary) [
"--ghc-options=-haddock"
];
setupCompileFlags = [
(optionalString (!coreSetup) "-${nativePackageDbFlag}=$setupPackageConfDir")
(optionalString enableParallelBuilding (parallelBuildingFlags))
"-threaded" # https://github.com/haskell/cabal/issues/2398
"-rtsopts" # allow us to pass RTS flags to the generated Setup executable
];
isHaskellPkg = x: x ? isHaskellLibrary;
allPkgconfigDepends = pkg-configDepends ++ libraryPkgconfigDepends ++ executablePkgconfigDepends ++
optionals doCheck testPkgconfigDepends ++ optionals doBenchmark benchmarkPkgconfigDepends;
depsBuildBuild = [ nativeGhc ];
collectedToolDepends =
buildTools ++ libraryToolDepends ++ executableToolDepends ++
optionals doCheck testToolDepends ++
optionals doBenchmark benchmarkToolDepends;
nativeBuildInputs =
[ ghc removeReferencesTo ] ++ optional (allPkgconfigDepends != []) pkg-config ++
setupHaskellDepends ++ collectedToolDepends;
propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends ++ libraryFrameworkDepends;
otherBuildInputsHaskell =
optionals doCheck (testDepends ++ testHaskellDepends) ++
optionals doBenchmark (benchmarkDepends ++ benchmarkHaskellDepends);
otherBuildInputsSystem =
extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++ executableFrameworkDepends ++
allPkgconfigDepends ++
optionals doCheck (testSystemDepends ++ testFrameworkDepends) ++
optionals doBenchmark (benchmarkSystemDepends ++ benchmarkFrameworkDepends);
# TODO next rebuild just define as `otherBuildInputsHaskell ++ otherBuildInputsSystem`
otherBuildInputs =
extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++ executableFrameworkDepends ++
allPkgconfigDepends ++
optionals doCheck (testDepends ++ testHaskellDepends ++ testSystemDepends ++ testFrameworkDepends) ++
optionals doBenchmark (benchmarkDepends ++ benchmarkHaskellDepends ++ benchmarkSystemDepends ++ benchmarkFrameworkDepends);
setupCommand = "./Setup";
ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
ghcCommand = "${ghc.targetPrefix}${ghcCommand'}";
ghcNameWithPrefix = "${ghc.targetPrefix}${ghc.haskellCompilerName}";
nativeGhcCommand = "${nativeGhc.targetPrefix}ghc";
buildPkgDb = ghcName: packageConfDir: ''
# If this dependency has a package database, then copy the contents of it,
# unless it is one of our GHCs. These can appear in our dependencies when
# we are doing native builds, and they have package databases in them, but
# we do not want to copy them over.
#
# We don't need to, since those packages will be provided by the GHC when
# we compile with it, and doing so can result in having multiple copies of
# e.g. Cabal in the database with the same name and version, which is
# ambiguous.
if [ -d "$p/lib/${ghcName}/package.conf.d" ] && [ "$p" != "${ghc}" ] && [ "$p" != "${nativeGhc}" ]; then
cp -f "$p/lib/${ghcName}/package.conf.d/"*.conf ${packageConfDir}/
continue
fi
'';
in lib.fix (drv:
assert allPkgconfigDepends != [] -> pkg-config != null;
stdenv.mkDerivation ({
inherit pname version;
outputs = [ "out" ]
++ (optional enableSeparateDataOutput "data")
++ (optional enableSeparateDocOutput "doc")
++ (optional enableSeparateBinOutput "bin");
setOutputFlags = false;
pos = builtins.unsafeGetAttrPos "pname" args;
prePhases = ["setupCompilerEnvironmentPhase"];
preConfigurePhases = ["compileBuildDriverPhase"];
preInstallPhases = ["haddockPhase"];
inherit src;
inherit depsBuildBuild nativeBuildInputs;
buildInputs = otherBuildInputs ++ optionals (!isLibrary) propagatedBuildInputs;
propagatedBuildInputs = optionals isLibrary propagatedBuildInputs;
LANG = "en_US.UTF-8"; # GHC needs the locale configured during the Haddock phase.
prePatch = optionalString (editedCabalFile != null) ''
echo "Replace Cabal file with edited version from ${newCabalFileUrl}."
cp ${newCabalFile} ${pname}.cabal
'' + prePatch;
postPatch = optionalString jailbreak ''
echo "Run jailbreak-cabal to lift version restrictions on build inputs."
${jailbreak-cabal}/bin/jailbreak-cabal ${pname}.cabal
'' + postPatch;
setupCompilerEnvironmentPhase = ''
NIX_BUILD_CORES=$(( NIX_BUILD_CORES < ${toString maxBuildCores} ? NIX_BUILD_CORES : ${toString maxBuildCores} ))
runHook preSetupCompilerEnvironment
echo "Build with ${ghc}."
${optionalString (isLibrary && hyperlinkSource) "export PATH=${hscolour}/bin:$PATH"}
builddir="$(mktemp -d)"
setupPackageConfDir="$builddir/setup-package.conf.d"
mkdir -p $setupPackageConfDir
packageConfDir="$builddir/package.conf.d"
mkdir -p $packageConfDir
setupCompileFlags="${concatStringsSep " " setupCompileFlags}"
configureFlags="${concatStringsSep " " defaultConfigureFlags} $configureFlags"
''
# We build the Setup.hs on the *build* machine, and as such should only add
# dependencies for the build machine.
#
# pkgs* arrays defined in stdenv/setup.hs
+ ''
for p in "''${pkgsBuildBuild[@]}" "''${pkgsBuildHost[@]}" "''${pkgsBuildTarget[@]}"; do
${buildPkgDb "${nativeGhcCommand}-${nativeGhc.version}" "$setupPackageConfDir"}
done
${nativeGhcCommand}-pkg --${nativePackageDbFlag}="$setupPackageConfDir" recache
''
# For normal components
+ ''
for p in "''${pkgsHostHost[@]}" "''${pkgsHostTarget[@]}"; do
${buildPkgDb ghcNameWithPrefix "$packageConfDir"}
if [ -d "$p/include" ]; then
configureFlags+=" --extra-include-dirs=$p/include"
fi
if [ -d "$p/lib" ]; then
configureFlags+=" --extra-lib-dirs=$p/lib"
fi
''
# It is not clear why --extra-framework-dirs does work fine on Linux
+ optionalString (!stdenv.buildPlatform.isDarwin || versionAtLeast nativeGhc.version "8.0") ''
if [[ -d "$p/Library/Frameworks" ]]; then
configureFlags+=" --extra-framework-dirs=$p/Library/Frameworks"
fi
'' + ''
done
''
# only use the links hack if we're actually building dylibs. otherwise, the
# "dynamic-library-dirs" point to nonexistent paths, and the ln command becomes
# "ln -s $out/lib/links", which tries to recreate the links dir and fails
+ (optionalString (stdenv.isDarwin && (enableSharedLibraries || enableSharedExecutables)) ''
# Work around a limit in the macOS Sierra linker on the number of paths
# referenced by any one dynamic library:
#
# Create a local directory with symlinks of the *.dylib (macOS shared
# libraries) from all the dependencies.
local dynamicLinksDir="$out/lib/links"
mkdir -p $dynamicLinksDir
# Unprettify all package conf files before reading/writing them
for d in "$packageConfDir/"*; do
# gawk -i inplace seems to strip the last newline
gawk -f ${unprettyConf} "$d" > tmp
mv tmp "$d"
done
for d in $(grep '^dynamic-library-dirs:' "$packageConfDir"/* | cut -d' ' -f2- | tr ' ' '\n' | sort -u); do
for lib in "$d/"*.{dylib,so}; do
# Allow overwriting because C libs can be pulled in multiple times.
ln -sf "$lib" "$dynamicLinksDir"
done
done
# Edit the local package DB to reference the links directory.
for f in "$packageConfDir/"*.conf; do
sed -i "s,dynamic-library-dirs: .*,dynamic-library-dirs: $dynamicLinksDir," "$f"
done
'') + ''
${ghcCommand}-pkg --${packageDbFlag}="$packageConfDir" recache
runHook postSetupCompilerEnvironment
'';
compileBuildDriverPhase = ''
runHook preCompileBuildDriver
for i in Setup.hs Setup.lhs ${defaultSetupHs}; do
test -f $i && break
done
echo setupCompileFlags: $setupCompileFlags
${nativeGhcCommand} $setupCompileFlags --make -o Setup -odir $builddir -hidir $builddir $i
runHook postCompileBuildDriver
'';
# Cabal takes flags like `--configure-option=--host=...` instead
configurePlatforms = [];
inherit configureFlags;
# Note: the options here must be always added, regardless of whether the
# package specifies `hardeningDisable`.
hardeningDisable = lib.optionals (args ? hardeningDisable) hardeningDisable
++ lib.optional (ghc.isHaLVM or false) "all"
# Static libraries (ie. all of pkgsStatic.haskellPackages) fail to build
# because by default Nix adds `-pie` to the linker flags: this
# conflicts with the `-r` and `-no-pie` flags added by GHC (see
# https://gitlab.haskell.org/ghc/ghc/-/issues/19580). hardeningDisable
# changes the default Nix behavior regarding adding "hardening" flags.
++ lib.optional enableStaticLibraries "pie";
configurePhase = ''
runHook preConfigure
unset GHC_PACKAGE_PATH # Cabal complains if this variable is set during configure.
echo configureFlags: $configureFlags
${setupCommand} configure $configureFlags 2>&1 | ${coreutils}/bin/tee "$NIX_BUILD_TOP/cabal-configure.log"
${lib.optionalString (!allowInconsistentDependencies) ''
if ${gnugrep}/bin/egrep -q -z 'Warning:.*depends on multiple versions' "$NIX_BUILD_TOP/cabal-configure.log"; then
echo >&2 "*** abort because of serious configure-time warning from Cabal"
exit 1
fi
''}
export GHC_PACKAGE_PATH="$packageConfDir:"
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
${setupCommand} build ${buildTarget}${crossCabalFlagsString}${buildFlagsString}
runHook postBuild
'';
inherit doCheck;
# Run test suite(s) and pass `checkFlags` as well as `checkFlagsArray`.
# `testFlags` are added to `checkFlagsArray` each prefixed with
# `--test-option`, so Cabal passes it to the underlying test suite binary.
checkPhase = ''
runHook preCheck
checkFlagsArray+=(
"--show-details=streaming"
${lib.escapeShellArgs (builtins.map (opt: "--test-option=${opt}") testFlags)}
)
${setupCommand} test ${testTarget} $checkFlags ''${checkFlagsArray:+"''${checkFlagsArray[@]}"}
runHook postCheck
'';
haddockPhase = ''
runHook preHaddock
${optionalString (doHaddock && isLibrary) ''
${setupCommand} haddock --html \
${optionalString doHoogle "--hoogle"} \
${optionalString doHaddockQuickjump "--quickjump"} \
${optionalString (isLibrary && hyperlinkSource) "--hyperlink-source"} \
${lib.concatStringsSep " " haddockFlags}
''}
runHook postHaddock
'';
installPhase = ''
runHook preInstall
${if !isLibrary && buildTarget == "" then "${setupCommand} install"
# ^^ if the project is not a library, and no build target is specified, we can just use "install".
else if !isLibrary then "${setupCommand} copy ${buildTarget}"
# ^^ if the project is not a library, and we have a build target, then use "copy" to install
# just the target specified; "install" will error here, since not all targets have been built.
else ''
${setupCommand} copy ${buildTarget}
local packageConfDir="$out/lib/${ghcNameWithPrefix}/package.conf.d"
local packageConfFile="$packageConfDir/${pname}-${version}.conf"
mkdir -p "$packageConfDir"
${setupCommand} register --gen-pkg-config=$packageConfFile
if [ -d "$packageConfFile" ]; then
mv "$packageConfFile/"* "$packageConfDir"
rmdir "$packageConfFile"
fi
for packageConfFile in "$packageConfDir/"*; do
local pkgId=$(gawk -f ${unprettyConf} "$packageConfFile" \
| grep '^id:' | cut -d' ' -f2)
mv "$packageConfFile" "$packageConfDir/$pkgId.conf"
done
# delete confdir if there are no libraries
find $packageConfDir -maxdepth 0 -empty -delete;
''}
${optionalString isGhcjs ''
for exeDir in "${binDir}/"*.jsexe; do
exe="''${exeDir%.jsexe}"
printWords '#!${nodejs}/bin/node' > "$exe"
echo >> "$exe"
cat "$exeDir/all.js" >> "$exe"
chmod +x "$exe"
done
''}
${optionalString doCoverage "mkdir -p $out/share && cp -r dist/hpc $out/share"}
${optionalString (enableSharedExecutables && isExecutable && !isGhcjs && stdenv.isDarwin && lib.versionOlder ghc.version "7.10") ''
for exe in "${binDir}/"* ; do
install_name_tool -add_rpath "$out/lib/ghc-${ghc.version}/${pname}-${version}" "$exe"
done
''}
${optionalString enableSeparateDocOutput ''
for x in ${docdir "$doc"}"/html/src/"*.html; do
remove-references-to -t $out $x
done
mkdir -p $doc
''}
${optionalString enableSeparateDataOutput "mkdir -p $data"}
runHook postInstall
'';
passthru = passthru // rec {
inherit pname version;
compiler = ghc;
# All this information is intended just for `shellFor`. It should be
# considered unstable and indeed we knew how to keep it private we would.
getCabalDeps = {
inherit
buildDepends
buildTools
executableFrameworkDepends
executableHaskellDepends
executablePkgconfigDepends
executableSystemDepends
executableToolDepends
extraLibraries
libraryFrameworkDepends
libraryHaskellDepends
libraryPkgconfigDepends
librarySystemDepends
libraryToolDepends
pkg-configDepends
setupHaskellDepends
;
} // lib.optionalAttrs doCheck {
inherit
testDepends
testFrameworkDepends
testHaskellDepends
testPkgconfigDepends
testSystemDepends
testToolDepends
;
} // lib.optionalAttrs doBenchmark {
inherit
benchmarkDepends
benchmarkFrameworkDepends
benchmarkHaskellDepends
benchmarkPkgconfigDepends
benchmarkSystemDepends
benchmarkToolDepends
;
};
# Attributes for the old definition of `shellFor`. Should be removed but
# this predates the warning at the top of `getCabalDeps`.
getBuildInputs = rec {
inherit propagatedBuildInputs otherBuildInputs allPkgconfigDepends;
haskellBuildInputs = isHaskellPartition.right;
systemBuildInputs = isHaskellPartition.wrong;
isHaskellPartition = lib.partition
isHaskellPkg
(propagatedBuildInputs ++ otherBuildInputs ++ depsBuildBuild ++ nativeBuildInputs);
};
isHaskellLibrary = isLibrary;
# TODO: ask why the split outputs are configurable at all?
# TODO: include tests for split if possible
# Given the haskell package, returns
# the directory containing the haddock documentation.
# `null' if no haddock documentation was built.
# TODO: fetch the self from the fixpoint instead
haddockDir = self: if doHaddock then "${docdir self.doc}/html" else null;
# Creates a derivation containing all of the necessary dependencies for building the
# parent derivation. The attribute set that it takes as input can be viewed as:
#
# { withHoogle }
#
# The derivation that it builds contains no outpaths because it is meant for use
# as an environment
#
# # Example use
# # Creates a shell with all of the dependencies required to build the "hello" package,
# # and with python:
#
# > nix-shell -E 'with (import <nixpkgs> {}); \
# > haskell.packages.ghc865.hello.envFunc { buildInputs = [ python ]; }'
envFunc = { withHoogle ? false }:
let
name = "ghc-shell-for-${drv.name}";
withPackages = if withHoogle then ghcWithHoogle else ghcWithPackages;
# We use the `ghcWithPackages` function from `buildHaskellPackages` if we
# want a shell for the sake of cross compiling a package. In the native case
# we don't use this at all, and instead put the setupDepends in the main
# `ghcWithPackages`. This way we don't have two wrapper scripts called `ghc`
# shadowing each other on the PATH.
ghcEnvForBuild =
assert isCross;
buildHaskellPackages.ghcWithPackages (_: setupHaskellDepends);
ghcEnv = withPackages (_:
otherBuildInputsHaskell ++
propagatedBuildInputs ++
lib.optionals (!isCross) setupHaskellDepends);
ghcCommandCaps = lib.toUpper ghcCommand';
in stdenv.mkDerivation ({
inherit name shellHook;
depsBuildBuild = lib.optional isCross ghcEnvForBuild;
nativeBuildInputs =
[ ghcEnv ] ++ optional (allPkgconfigDepends != []) pkg-config ++
collectedToolDepends;
buildInputs =
otherBuildInputsSystem;
phases = ["installPhase"];
installPhase = "echo $nativeBuildInputs $buildInputs > $out";
LANG = "en_US.UTF-8";
LOCALE_ARCHIVE = lib.optionalString (stdenv.hostPlatform.libc == "glibc") "${buildPackages.glibcLocales}/lib/locale/locale-archive";
"NIX_${ghcCommandCaps}" = "${ghcEnv}/bin/${ghcCommand}";
"NIX_${ghcCommandCaps}PKG" = "${ghcEnv}/bin/${ghcCommand}-pkg";
# TODO: is this still valid?
"NIX_${ghcCommandCaps}_DOCDIR" = "${ghcEnv}/share/doc/ghc/html";
"NIX_${ghcCommandCaps}_LIBDIR" = if ghc.isHaLVM or false
then "${ghcEnv}/lib/HaLVM-${ghc.version}"
else "${ghcEnv}/lib/${ghcCommand}-${ghc.version}";
});
env = envFunc { };
};
meta = { inherit homepage license platforms; }
// optionalAttrs (args ? broken) { inherit broken; }
// optionalAttrs (args ? description) { inherit description; }
// optionalAttrs (args ? maintainers) { inherit maintainers; }
// optionalAttrs (args ? hydraPlatforms) { inherit hydraPlatforms; }
// optionalAttrs (args ? badPlatforms) { inherit badPlatforms; }
// optionalAttrs (args ? changelog) { inherit changelog; }
// optionalAttrs (args ? mainProgram) { inherit mainProgram; }
;
}
// optionalAttrs (args ? preCompileBuildDriver) { inherit preCompileBuildDriver; }
// optionalAttrs (args ? postCompileBuildDriver) { inherit postCompileBuildDriver; }
// optionalAttrs (args ? preUnpack) { inherit preUnpack; }
// optionalAttrs (args ? postUnpack) { inherit postUnpack; }
// optionalAttrs (args ? patches) { inherit patches; }
// optionalAttrs (args ? patchPhase) { inherit patchPhase; }
// optionalAttrs (args ? preConfigure) { inherit preConfigure; }
// optionalAttrs (args ? postConfigure) { inherit postConfigure; }
// optionalAttrs (args ? preBuild) { inherit preBuild; }
// optionalAttrs (args ? postBuild) { inherit postBuild; }
// optionalAttrs (args ? doBenchmark) { inherit doBenchmark; }
// optionalAttrs (args ? checkPhase) { inherit checkPhase; }
// optionalAttrs (args ? preCheck) { inherit preCheck; }
// optionalAttrs (args ? postCheck) { inherit postCheck; }
// optionalAttrs (args ? preHaddock) { inherit preHaddock; }
// optionalAttrs (args ? postHaddock) { inherit postHaddock; }
// optionalAttrs (args ? preInstall) { inherit preInstall; }
// optionalAttrs (args ? installPhase) { inherit installPhase; }
// optionalAttrs (args ? postInstall) { inherit postInstall; }
// optionalAttrs (args ? preFixup) { inherit preFixup; }
// optionalAttrs (args ? postFixup) { inherit postFixup; }
// optionalAttrs (args ? dontStrip) { inherit dontStrip; }
// optionalAttrs (stdenv.buildPlatform.libc == "glibc"){ LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive"; }
)
)

View file

@ -0,0 +1,78 @@
{ stdenv, ghc, pkg-config, glibcLocales
, cacert, stack, makeSetupHook, lib }@depArgs:
{ buildInputs ? []
, nativeBuildInputs ? []
, extraArgs ? []
, LD_LIBRARY_PATH ? []
, ghc ? depArgs.ghc
, stack ? depArgs.stack
, ...
}@args:
let
stackCmd = "stack --internal-re-exec-version=${stack.version}";
# Add all dependencies in buildInputs including propagated ones to
# STACK_IN_NIX_EXTRA_ARGS.
stackHook = makeSetupHook {} ./stack-hook.sh;
in stdenv.mkDerivation (args // {
# Doesn't work in the sandbox. Pass `--option sandbox relaxed` or
# `--option sandbox false` to be able to build this
__noChroot = true;
buildInputs = buildInputs
++ lib.optional (stdenv.hostPlatform.libc == "glibc") glibcLocales;
nativeBuildInputs = nativeBuildInputs
++ [ ghc pkg-config stack stackHook ];
STACK_PLATFORM_VARIANT = "nix";
STACK_IN_NIX_SHELL = 1;
STACK_IN_NIX_EXTRA_ARGS = extraArgs;
# XXX: workaround for https://ghc.haskell.org/trac/ghc/ticket/11042.
LD_LIBRARY_PATH = lib.makeLibraryPath (LD_LIBRARY_PATH ++ buildInputs);
# ^^^ Internally uses `getOutput "lib"` (equiv. to getLib)
# Non-NixOS git needs cert
GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
# Fixes https://github.com/commercialhaskell/stack/issues/2358
LANG = "en_US.UTF-8";
preferLocalBuild = true;
preConfigure = ''
export STACK_ROOT=$NIX_BUILD_TOP/.stack
'';
buildPhase = args.buildPhase or ''
runHook preBuild
${stackCmd} build
runHook postBuild
'';
checkPhase = args.checkPhase or ''
runHook preCheck
${stackCmd} test
runHook postCheck
'';
doCheck = args.doCheck or true;
installPhase = args.installPhase or ''
runHook preInstall
${stackCmd} --local-bin-path=$out/bin build --copy-bins
runHook postInstall
'';
})

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,5 @@
#! @shell@
COMMAND=$1
shift
exec @hoogle@/bin/hoogle "$COMMAND" --database @out@/share/doc/hoogle/default.hoo "$@"

View file

@ -0,0 +1,127 @@
# Install not only the Hoogle library and executable, but also a local Hoogle
# database which provides "Source" links to all specified 'packages' -- or the
# current Haskell Platform if no custom package set is provided.
{ lib, stdenv, buildPackages, haskellPackages
, writeText
}:
# This argument is a function which selects a list of Haskell packages from any
# passed Haskell package set.
#
# Example:
# (hpkgs: [ hpkgs.mtl hpkgs.lens ])
selectPackages:
let
inherit (haskellPackages) ghc hoogle;
packages = selectPackages haskellPackages;
wrapper = ./hoogle-local-wrapper.sh;
isGhcjs = ghc.isGhcjs or false;
opts = lib.optionalString;
haddockExe =
if !isGhcjs
then "haddock"
else "haddock-ghcjs";
ghcDocLibDir =
if !isGhcjs
then ghc.doc + "/share/doc/ghc*/html/libraries"
else ghc + "/doc/lib";
# On GHCJS, use a stripped down version of GHC's prologue.txt
prologue =
if !isGhcjs
then "${ghcDocLibDir}/prologue.txt"
else writeText "ghcjs-prologue.txt" ''
This index includes documentation for many Haskell modules.
'';
# TODO: closePropagation is deprecated; replace
docPackages = lib.closePropagation
# we grab the doc outputs
(map (lib.getOutput "doc") packages);
in
buildPackages.stdenv.mkDerivation {
name = "hoogle-with-packages";
buildInputs = [ghc hoogle];
# compiling databases takes less time than copying the results
# between machines.
preferLocalBuild = true;
# we still allow substitutes because a database is relatively small and if it
# is already built downloading is probably faster. The substitution will only
# trigger for users who have already cached the database on a substituter and
# thus probably intend to substitute it.
allowSubstitutes = true;
inherit docPackages;
passAsFile = ["buildCommand"];
buildCommand = ''
${let # Filter out nulls here to work around https://github.com/NixOS/nixpkgs/issues/82245
# If we don't then grabbing `p.name` here will fail.
packages' = lib.filter (p: p != null) packages;
in lib.optionalString (packages' != [] -> docPackages == [])
("echo WARNING: localHoogle package list empty, even though"
+ " the following were specified: "
+ lib.concatMapStringsSep ", " (p: p.name) packages')}
mkdir -p $out/share/doc/hoogle
echo importing builtin packages
for docdir in ${ghcDocLibDir}"/"*; do
name="$(basename $docdir)"
${opts isGhcjs ''docdir="$docdir/html"''}
if [[ -d $docdir ]]; then
ln -sfn $docdir $out/share/doc/hoogle/$name
fi
done
echo importing other packages
${lib.concatMapStringsSep "\n" (el: ''
ln -sfn ${el.haddockDir} "$out/share/doc/hoogle/${el.name}"
'')
(lib.filter (el: el.haddockDir != null)
(builtins.map (p: { haddockDir = if p ? haddockDir then p.haddockDir p else null;
name = p.pname; })
docPackages))}
echo building hoogle database
hoogle generate --database $out/share/doc/hoogle/default.hoo --local=$out/share/doc/hoogle
echo building haddock index
# adapted from GHC's gen_contents_index
cd $out/share/doc/hoogle
args=
for hdfile in $(ls -1 *"/"*.haddock | grep -v '/ghc\.haddock' | sort); do
name_version=`echo "$hdfile" | sed 's#/.*##'`
args="$args --read-interface=$name_version,$hdfile"
done
${ghc}/bin/${haddockExe} --gen-index --gen-contents -o . \
-t "Haskell Hierarchical Libraries" \
-p ${prologue} \
$args
echo finishing up
mkdir -p $out/bin
substitute ${wrapper} $out/bin/hoogle \
--subst-var out --subst-var-by shell ${stdenv.shell} \
--subst-var-by hoogle ${hoogle}
chmod +x $out/bin/hoogle
'';
passthru = {
isHaskellLibrary = false; # for the filter in ./with-packages-wrapper.nix
};
meta = {
description = "A local Hoogle database";
platforms = ghc.meta.platforms;
hydraPlatforms = with lib.platforms; none;
maintainers = with lib.maintainers; [ ttuegel ];
};
}

View file

@ -0,0 +1,2 @@
args@{ pkgs, lib, callPackage }: self:
(import ./hackage-packages.nix args self)

View file

@ -0,0 +1,473 @@
# TODO(@Ericson2314): Remove `pkgs` param, which is only used for
# `buildStackProject`, `justStaticExecutables` and `checkUnusedPackages`
{ pkgs, lib }:
rec {
/* This function takes a file like `hackage-packages.nix` and constructs
a full package set out of that.
*/
makePackageSet = import ../make-package-set.nix;
/* The function overrideCabal lets you alter the arguments to the
mkDerivation function.
Example:
First, note how the aeson package is constructed in hackage-packages.nix:
"aeson" = callPackage ({ mkDerivation, attoparsec, <snip>
}:
mkDerivation {
pname = "aeson";
<snip>
homepage = "https://github.com/bos/aeson";
})
The mkDerivation function of haskellPackages will take care of putting
the homepage in the right place, in meta.
> haskellPackages.aeson.meta.homepage
"https://github.com/bos/aeson"
> x = haskell.lib.compose.overrideCabal (old: { homepage = old.homepage + "#readme"; }) haskellPackages.aeson
> x.meta.homepage
"https://github.com/bos/aeson#readme"
*/
overrideCabal = f: drv: (drv.override (args: args // {
mkDerivation = drv: (args.mkDerivation drv).override f;
})) // {
overrideScope = scope: overrideCabal f (drv.overrideScope scope);
};
# : Map Name (Either Path VersionNumber) -> HaskellPackageOverrideSet
# Given a set whose values are either paths or version strings, produces
# a package override set (i.e. (self: super: { etc. })) that sets
# the packages named in the input set to the corresponding versions
packageSourceOverrides =
overrides: self: super: pkgs.lib.mapAttrs (name: src:
let isPath = x: builtins.substring 0 1 (toString x) == "/";
generateExprs = if isPath src
then self.callCabal2nix
else self.callHackage;
in generateExprs name src {}) overrides;
/* doCoverage modifies a haskell package to enable the generation
and installation of a coverage report.
See https://wiki.haskell.org/Haskell_program_coverage
*/
doCoverage = overrideCabal (drv: { doCoverage = true; });
/* dontCoverage modifies a haskell package to disable the generation
and installation of a coverage report.
*/
dontCoverage = overrideCabal (drv: { doCoverage = false; });
/* doHaddock modifies a haskell package to enable the generation and
installation of API documentation from code comments using the
haddock tool.
*/
doHaddock = overrideCabal (drv: { doHaddock = true; });
/* dontHaddock modifies a haskell package to disable the generation and
installation of API documentation from code comments using the
haddock tool.
*/
dontHaddock = overrideCabal (drv: { doHaddock = false; });
/* doJailbreak enables the removal of version bounds from the cabal
file. You may want to avoid this function.
This is useful when a package reports that it can not be built
due to version mismatches. In some cases, removing the version
bounds entirely is an easy way to make a package build, but at
the risk of breaking software in non-obvious ways now or in the
future.
Instead of jailbreaking, you can patch the cabal file.
Note that jailbreaking at this time, doesn't lift bounds on
conditional branches.
https://github.com/peti/jailbreak-cabal/issues/7 has further details.
*/
doJailbreak = overrideCabal (drv: { jailbreak = true; });
/* dontJailbreak restores the use of the version bounds the check
the use of dependencies in the package description.
*/
dontJailbreak = overrideCabal (drv: { jailbreak = false; });
/* doCheck enables dependency checking, compilation and execution
of test suites listed in the package description file.
*/
doCheck = overrideCabal (drv: { doCheck = true; });
/* dontCheck disables dependency checking, compilation and execution
of test suites listed in the package description file.
*/
dontCheck = overrideCabal (drv: { doCheck = false; });
/* doBenchmark enables dependency checking, compilation and execution
for benchmarks listed in the package description file.
*/
doBenchmark = overrideCabal (drv: { doBenchmark = true; });
/* dontBenchmark disables dependency checking, compilation and execution
for benchmarks listed in the package description file.
*/
dontBenchmark = overrideCabal (drv: { doBenchmark = false; });
/* doDistribute enables the distribution of binaries for the package
via hydra.
*/
doDistribute = overrideCabal (drv: {
# lib.platforms.all is the default value for platforms (since GHC can cross-compile)
hydraPlatforms = drv.platforms or lib.platforms.all;
});
/* dontDistribute disables the distribution of binaries for the package
via hydra.
*/
dontDistribute = overrideCabal (drv: { hydraPlatforms = []; });
/* appendConfigureFlag adds a single argument that will be passed to the
cabal configure command, after the arguments that have been defined
in the initial declaration or previous overrides.
Example:
> haskell.lib.compose.appendConfigureFlag "--profiling-detail=all-functions" haskellPackages.servant
*/
appendConfigureFlag = x: appendConfigureFlags [x];
appendConfigureFlags = xs: overrideCabal (drv: { configureFlags = (drv.configureFlags or []) ++ xs; });
appendBuildFlag = x: overrideCabal (drv: { buildFlags = (drv.buildFlags or []) ++ [x]; });
appendBuildFlags = xs: overrideCabal (drv: { buildFlags = (drv.buildFlags or []) ++ xs; });
/* removeConfigureFlag drv x is a Haskell package like drv, but with
all cabal configure arguments that are equal to x removed.
> haskell.lib.compose.removeConfigureFlag "--verbose" haskellPackages.servant
*/
removeConfigureFlag = x: overrideCabal (drv: { configureFlags = lib.remove x (drv.configureFlags or []); });
addBuildTool = x: addBuildTools [x];
addBuildTools = xs: overrideCabal (drv: { buildTools = (drv.buildTools or []) ++ xs; });
addExtraLibrary = x: addExtraLibraries [x];
addExtraLibraries = xs: overrideCabal (drv: { extraLibraries = (drv.extraLibraries or []) ++ xs; });
addBuildDepend = x: addBuildDepends [x];
addBuildDepends = xs: overrideCabal (drv: { buildDepends = (drv.buildDepends or []) ++ xs; });
addTestToolDepend = x: addTestToolDepends [x];
addTestToolDepends = xs: overrideCabal (drv: { testToolDepends = (drv.testToolDepends or []) ++ xs; });
addPkgconfigDepend = x: addPkgconfigDepends [x];
addPkgconfigDepends = xs: overrideCabal (drv: { pkg-configDepends = (drv.pkg-configDepends or []) ++ xs; });
addSetupDepend = x: addSetupDepends [x];
addSetupDepends = xs: overrideCabal (drv: { setupHaskellDepends = (drv.setupHaskellDepends or []) ++ xs; });
enableCabalFlag = x: drv: appendConfigureFlag "-f${x}" (removeConfigureFlag "-f-${x}" drv);
disableCabalFlag = x: drv: appendConfigureFlag "-f-${x}" (removeConfigureFlag "-f${x}" drv);
markBroken = overrideCabal (drv: { broken = true; hydraPlatforms = []; });
unmarkBroken = overrideCabal (drv: { broken = false; });
markBrokenVersion = version: drv: assert drv.version == version; markBroken drv;
markUnbroken = overrideCabal (drv: { broken = false; });
enableLibraryProfiling = overrideCabal (drv: { enableLibraryProfiling = true; });
disableLibraryProfiling = overrideCabal (drv: { enableLibraryProfiling = false; });
enableExecutableProfiling = overrideCabal (drv: { enableExecutableProfiling = true; });
disableExecutableProfiling = overrideCabal (drv: { enableExecutableProfiling = false; });
enableSharedExecutables = overrideCabal (drv: { enableSharedExecutables = true; });
disableSharedExecutables = overrideCabal (drv: { enableSharedExecutables = false; });
enableSharedLibraries = overrideCabal (drv: { enableSharedLibraries = true; });
disableSharedLibraries = overrideCabal (drv: { enableSharedLibraries = false; });
enableDeadCodeElimination = overrideCabal (drv: { enableDeadCodeElimination = true; });
disableDeadCodeElimination = overrideCabal (drv: { enableDeadCodeElimination = false; });
enableStaticLibraries = overrideCabal (drv: { enableStaticLibraries = true; });
disableStaticLibraries = overrideCabal (drv: { enableStaticLibraries = false; });
enableSeparateBinOutput = overrideCabal (drv: { enableSeparateBinOutput = true; });
appendPatch = x: appendPatches [x];
appendPatches = xs: overrideCabal (drv: { patches = (drv.patches or []) ++ xs; });
/* Set a specific build target instead of compiling all targets in the package.
* For example, imagine we have a .cabal file with a library, and 2 executables "dev" and "server".
* We can build only "server" and not wait on the compilation of "dev" by using setBuildTarget as follows:
*
* > setBuildTarget "server" (callCabal2nix "thePackageName" thePackageSrc {})
*
*/
setBuildTargets = xs: overrideCabal (drv: { buildTarget = lib.concatStringsSep " " xs; });
setBuildTarget = x: setBuildTargets [x];
doHyperlinkSource = overrideCabal (drv: { hyperlinkSource = true; });
dontHyperlinkSource = overrideCabal (drv: { hyperlinkSource = false; });
disableHardening = flags: overrideCabal (drv: { hardeningDisable = flags; });
/* Let Nix strip the binary files.
* This removes debugging symbols.
*/
doStrip = overrideCabal (drv: { dontStrip = false; });
/* Stop Nix from stripping the binary files.
* This keeps debugging symbols.
*/
dontStrip = overrideCabal (drv: { dontStrip = true; });
/* Useful for debugging segfaults with gdb.
* This includes dontStrip.
*/
enableDWARFDebugging = drv:
# -g: enables debugging symbols
# --disable-*-stripping: tell GHC not to strip resulting binaries
# dontStrip: see above
appendConfigureFlag "--ghc-options=-g --disable-executable-stripping --disable-library-stripping" (dontStrip drv);
/* Create a source distribution tarball like those found on hackage,
instead of building the package.
*/
sdistTarball = pkg: lib.overrideDerivation pkg (drv: {
name = "${drv.pname}-source-${drv.version}";
# Since we disable the haddock phase, we also need to override the
# outputs since the separate doc output will not be produced.
outputs = ["out"];
buildPhase = "./Setup sdist";
haddockPhase = ":";
checkPhase = ":";
installPhase = "install -D dist/${drv.pname}-*.tar.gz $out/${drv.pname}-${drv.version}.tar.gz";
fixupPhase = ":";
});
/* Create a documentation tarball suitable for uploading to Hackage instead
of building the package.
*/
documentationTarball = pkg:
pkgs.lib.overrideDerivation pkg (drv: {
name = "${drv.name}-docs";
# Like sdistTarball, disable the "doc" output here.
outputs = [ "out" ];
buildPhase = ''
runHook preHaddock
./Setup haddock --for-hackage
runHook postHaddock
'';
haddockPhase = ":";
checkPhase = ":";
installPhase = ''
runHook preInstall
mkdir -p "$out"
tar --format=ustar \
-czf "$out/${drv.name}-docs.tar.gz" \
-C dist/doc/html "${drv.name}-docs"
runHook postInstall
'';
});
/* Use the gold linker. It is a linker for ELF that is designed
"to run as fast as possible on modern systems"
*/
linkWithGold = appendConfigureFlag
"--ghc-option=-optl-fuse-ld=gold --ld-option=-fuse-ld=gold --with-ld=ld.gold";
/* link executables statically against haskell libs to reduce
closure size
*/
justStaticExecutables = overrideCabal (drv: {
enableSharedExecutables = false;
enableLibraryProfiling = false;
isLibrary = false;
doHaddock = false;
postFixup = drv.postFixup or "" + ''
# Remove every directory which could have links to other store paths.
rm -rf $out/lib $out/nix-support $out/share/doc
'';
});
/* Build a source distribution tarball instead of using the source files
directly. The effect is that the package is built as if it were published
on hackage. This can be used as a test for the source distribution,
assuming the build fails when packaging mistakes are in the cabal file.
*/
buildFromSdist = pkg: overrideCabal (drv: {
src = "${sdistTarball pkg}/${pkg.pname}-${pkg.version}.tar.gz";
# Revising and jailbreaking the cabal file has been handled in sdistTarball
revision = null;
editedCabalFile = null;
jailbreak = false;
}) pkg;
/* Build the package in a strict way to uncover potential problems.
This includes buildFromSdist and failOnAllWarnings.
*/
buildStrictly = pkg: buildFromSdist (failOnAllWarnings pkg);
/* Disable core optimizations, significantly speeds up build time */
disableOptimization = appendConfigureFlag "--disable-optimization";
/* Turn on most of the compiler warnings and fail the build if any
of them occur. */
failOnAllWarnings = appendConfigureFlag "--ghc-option=-Wall --ghc-option=-Werror";
/* Add a post-build check to verify that dependencies declared in
the cabal file are actually used.
The first attrset argument can be used to configure the strictness
of this check and a list of ignored package names that would otherwise
cause false alarms.
*/
checkUnusedPackages =
{ ignoreEmptyImports ? false
, ignoreMainModule ? false
, ignorePackages ? []
} : drv :
overrideCabal (_drv: {
postBuild = with lib;
let args = concatStringsSep " " (
optional ignoreEmptyImports "--ignore-empty-imports" ++
optional ignoreMainModule "--ignore-main-module" ++
map (pkg: "--ignore-package ${pkg}") ignorePackages
);
in "${pkgs.haskellPackages.packunused}/bin/packunused" +
optionalString (args != "") " ${args}";
}) (appendConfigureFlag "--ghc-option=-ddump-minimal-imports" drv);
buildStackProject = pkgs.callPackage ../generic-stack-builder.nix { };
/* Add a dummy command to trigger a build despite an equivalent
earlier build that is present in the store or cache.
*/
triggerRebuild = i: overrideCabal (drv: { postUnpack = ": trigger rebuild ${toString i}"; });
/* Override the sources for the package and optionaly the version.
This also takes of removing editedCabalFile.
*/
overrideSrc = { src, version ? null }: drv:
overrideCabal (_: { inherit src; version = if version == null then drv.version else version; editedCabalFile = null; }) drv;
# Get all of the build inputs of a haskell package, divided by category.
getBuildInputs = p: p.getBuildInputs;
# Extract the haskell build inputs of a haskell package.
# This is useful to build environments for developing on that
# package.
getHaskellBuildInputs = p: (getBuildInputs p).haskellBuildInputs;
# Under normal evaluation, simply return the original package. Under
# nix-shell evaluation, return a nix-shell optimized environment.
shellAware = p: if lib.inNixShell then p.env else p;
ghcInfo = ghc:
rec { isCross = (ghc.cross or null) != null;
isGhcjs = ghc.isGhcjs or false;
nativeGhc = if isCross || isGhcjs
then ghc.bootPkgs.ghc
else ghc;
};
### mkDerivation helpers
# These allow external users of a haskell package to extract
# information about how it is built in the same way that the
# generic haskell builder does, by reusing the same functions.
# Each function here has the same interface as mkDerivation and thus
# can be called for a given package simply by overriding the
# mkDerivation argument it used. See getHaskellBuildInputs above for
# an example of this.
# Some information about which phases should be run.
controlPhases = ghc: let inherit (ghcInfo ghc) isCross; in
{ doCheck ? !isCross && (lib.versionOlder "7.4" ghc.version)
, doBenchmark ? false
, ...
}: { inherit doCheck doBenchmark; };
# Utility to convert a directory full of `cabal2nix`-generated files into a
# package override set
#
# packagesFromDirectory : { directory : Directory, ... } -> HaskellPackageOverrideSet
packagesFromDirectory =
{ directory, ... }:
self: super:
let
haskellPaths = builtins.attrNames (builtins.readDir directory);
toKeyVal = file: {
name = builtins.replaceStrings [ ".nix" ] [ "" ] file;
value = self.callPackage (directory + "/${file}") { };
};
in
builtins.listToAttrs (map toKeyVal haskellPaths);
addOptparseApplicativeCompletionScripts = exeName: pkg:
builtins.trace "addOptparseApplicativeCompletionScripts is deprecated in favor of generateOptparseApplicativeCompletion. Please change ${pkg.name} to use the latter or its plural form."
(generateOptparseApplicativeCompletion exeName pkg);
/*
Modify a Haskell package to add shell completion scripts for the
given executable produced by it. These completion scripts will be
picked up automatically if the resulting derivation is installed,
e.g. by `nix-env -i`.
Invocation:
generateOptparseApplicativeCompletion command pkg
command: name of an executable
pkg: Haskell package that builds the executables
*/
generateOptparseApplicativeCompletion = exeName: overrideCabal (drv: {
postInstall = (drv.postInstall or "") + ''
bashCompDir="''${!outputBin}/share/bash-completion/completions"
zshCompDir="''${!outputBin}/share/zsh/vendor-completions"
fishCompDir="''${!outputBin}/share/fish/vendor_completions.d"
mkdir -p "$bashCompDir" "$zshCompDir" "$fishCompDir"
"''${!outputBin}/bin/${exeName}" --bash-completion-script "''${!outputBin}/bin/${exeName}" >"$bashCompDir/${exeName}"
"''${!outputBin}/bin/${exeName}" --zsh-completion-script "''${!outputBin}/bin/${exeName}" >"$zshCompDir/_${exeName}"
"''${!outputBin}/bin/${exeName}" --fish-completion-script "''${!outputBin}/bin/${exeName}" >"$fishCompDir/${exeName}.fish"
# Sanity check
grep -F ${exeName} <$bashCompDir/${exeName} >/dev/null || {
echo 'Could not find ${exeName} in completion script.'
exit 1
}
'';
});
/*
Modify a Haskell package to add shell completion scripts for the
given executables produced by it. These completion scripts will be
picked up automatically if the resulting derivation is installed,
e.g. by `nix-env -i`.
Invocation:
generateOptparseApplicativeCompletions commands pkg
commands: name of an executable
pkg: Haskell package that builds the executables
*/
generateOptparseApplicativeCompletions = commands: pkg:
pkgs.lib.foldr generateOptparseApplicativeCompletion pkg commands;
# Don't fail at configure time if there are multiple versions of the
# same package in the (recursive) dependencies of the package being
# built. Will delay failures, if any, to compile time.
allowInconsistentDependencies = overrideCabal (drv: {
allowInconsistentDependencies = true;
});
}

View file

@ -0,0 +1,355 @@
# TODO(@Ericson2314): Remove `pkgs` param, which is only used for
# `buildStackProject`, `justStaticExecutables` and `checkUnusedPackages`
{ pkgs, lib }:
rec {
/* The same functionality as this haskell.lib, except that the derivation
being overridden is always the last parameter. This permits more natural
composition of several overrides, i.e. without having to nestle one call
between the function name and argument of another. haskell.lib.compose is
preferred for any new code.
*/
compose = import ./compose.nix { inherit pkgs lib; };
/* This function takes a file like `hackage-packages.nix` and constructs
a full package set out of that.
*/
makePackageSet = compose.makePackageSet;
/* The function overrideCabal lets you alter the arguments to the
mkDerivation function.
Example:
First, note how the aeson package is constructed in hackage-packages.nix:
"aeson" = callPackage ({ mkDerivation, attoparsec, <snip>
}:
mkDerivation {
pname = "aeson";
<snip>
homepage = "https://github.com/bos/aeson";
})
The mkDerivation function of haskellPackages will take care of putting
the homepage in the right place, in meta.
> haskellPackages.aeson.meta.homepage
"https://github.com/bos/aeson"
> x = haskell.lib.overrideCabal haskellPackages.aeson (old: { homepage = old.homepage + "#readme"; })
> x.meta.homepage
"https://github.com/bos/aeson#readme"
*/
overrideCabal = drv: f: compose.overrideCabal f drv;
# : Map Name (Either Path VersionNumber) -> HaskellPackageOverrideSet
# Given a set whose values are either paths or version strings, produces
# a package override set (i.e. (self: super: { etc. })) that sets
# the packages named in the input set to the corresponding versions
packageSourceOverrides = compose.packageSourceOverrides;
/* doCoverage modifies a haskell package to enable the generation
and installation of a coverage report.
See https://wiki.haskell.org/Haskell_program_coverage
*/
doCoverage = compose.doCoverage;
/* dontCoverage modifies a haskell package to disable the generation
and installation of a coverage report.
*/
dontCoverage = compose.dontCoverage;
/* doHaddock modifies a haskell package to enable the generation and
installation of API documentation from code comments using the
haddock tool.
*/
doHaddock = compose.doHaddock;
/* dontHaddock modifies a haskell package to disable the generation and
installation of API documentation from code comments using the
haddock tool.
*/
dontHaddock = compose.dontHaddock;
/* doJailbreak enables the removal of version bounds from the cabal
file. You may want to avoid this function.
This is useful when a package reports that it can not be built
due to version mismatches. In some cases, removing the version
bounds entirely is an easy way to make a package build, but at
the risk of breaking software in non-obvious ways now or in the
future.
Instead of jailbreaking, you can patch the cabal file.
Note that jailbreaking at this time, doesn't lift bounds on
conditional branches.
https://github.com/peti/jailbreak-cabal/issues/7 has further details.
*/
doJailbreak = compose.doJailbreak;
/* dontJailbreak restores the use of the version bounds the check
the use of dependencies in the package description.
*/
dontJailbreak = compose.dontJailbreak;
/* doCheck enables dependency checking, compilation and execution
of test suites listed in the package description file.
*/
doCheck = compose.doCheck;
/* dontCheck disables dependency checking, compilation and execution
of test suites listed in the package description file.
*/
dontCheck = compose.dontCheck;
/* doBenchmark enables dependency checking, compilation and execution
for benchmarks listed in the package description file.
*/
doBenchmark = compose.doBenchmark;
/* dontBenchmark disables dependency checking, compilation and execution
for benchmarks listed in the package description file.
*/
dontBenchmark = compose.dontBenchmark;
/* doDistribute enables the distribution of binaries for the package
via hydra.
*/
doDistribute = compose.doDistribute;
/* dontDistribute disables the distribution of binaries for the package
via hydra.
*/
dontDistribute = compose.dontDistribute;
/* appendConfigureFlag adds a single argument that will be passed to the
cabal configure command, after the arguments that have been defined
in the initial declaration or previous overrides.
Example:
> haskell.lib.appendConfigureFlag haskellPackages.servant "--profiling-detail=all-functions"
*/
appendConfigureFlag = drv: x: compose.appendConfigureFlag x drv;
appendConfigureFlags = drv: xs: compose.appendConfigureFlags xs drv;
appendBuildFlag = drv: x: compose.appendBuildFlag x drv;
appendBuildFlags = drv: xs: compose.appendBuildFlags xs drv;
/* removeConfigureFlag drv x is a Haskell package like drv, but with
all cabal configure arguments that are equal to x removed.
> haskell.lib.removeConfigureFlag haskellPackages.servant "--verbose"
*/
removeConfigureFlag = drv: x: compose.removeConfigureFlag x drv;
addBuildTool = drv: x: compose.addBuildTool x drv;
addBuildTools = drv: xs: compose.addBuildTools xs drv;
addExtraLibrary = drv: x: compose.addExtraLibrary x drv;
addExtraLibraries = drv: xs: compose.addExtraLibraries xs drv;
addBuildDepend = drv: x: compose.addBuildDepend x drv;
addBuildDepends = drv: xs: compose.addBuildDepends xs drv;
addTestToolDepend = drv: x: compose.addTestToolDepend x drv;
addTestToolDepends = drv: xs: compose.addTestToolDepends xs drv;
addPkgconfigDepend = drv: x: compose.addPkgconfigDepend x drv;
addPkgconfigDepends = drv: xs: compose.addPkgconfigDepends xs drv;
addSetupDepend = drv: x: compose.addSetupDepend x drv;
addSetupDepends = drv: xs: compose.addSetupDepends xs drv;
enableCabalFlag = drv: x: compose.enableCabalFlag x drv;
disableCabalFlag = drv: x: compose.disableCabalFlag x drv;
markBroken = compose.markBroken;
unmarkBroken = compose.unmarkBroken;
markBrokenVersion = compose.markBrokenVersion;
markUnbroken = compose.markUnbroken;
enableLibraryProfiling = compose.enableLibraryProfiling;
disableLibraryProfiling = compose.disableLibraryProfiling;
enableExecutableProfiling = compose.enableExecutableProfiling;
disableExecutableProfiling = compose.disableExecutableProfiling;
enableSharedExecutables = compose.enableSharedExecutables;
disableSharedExecutables = compose.disableSharedExecutables;
enableSharedLibraries = compose.enableSharedLibraries;
disableSharedLibraries = compose.disableSharedLibraries;
enableDeadCodeElimination = compose.enableDeadCodeElimination;
disableDeadCodeElimination = compose.disableDeadCodeElimination;
enableStaticLibraries = compose.enableStaticLibraries;
disableStaticLibraries = compose.disableStaticLibraries;
enableSeparateBinOutput = compose.enableSeparateBinOutput;
appendPatch = drv: x: compose.appendPatch x drv;
appendPatches = drv: xs: compose.appendPatches xs drv;
/* Set a specific build target instead of compiling all targets in the package.
* For example, imagine we have a .cabal file with a library, and 2 executables "dev" and "server".
* We can build only "server" and not wait on the compilation of "dev" by using setBuildTarget as follows:
*
* setBuildTarget (callCabal2nix "thePackageName" thePackageSrc {}) "server"
*
*/
setBuildTargets = drv: xs: compose.setBuildTargets xs drv;
setBuildTarget = drv: x: compose.setBuildTarget x drv;
doHyperlinkSource = compose.doHyperlinkSource;
dontHyperlinkSource = compose.dontHyperlinkSource;
disableHardening = drv: flags: compose.disableHardening flags drv;
/* Let Nix strip the binary files.
* This removes debugging symbols.
*/
doStrip = compose.doStrip;
/* Stop Nix from stripping the binary files.
* This keeps debugging symbols.
*/
dontStrip = compose.dontStrip;
/* Useful for debugging segfaults with gdb.
* This includes dontStrip.
*/
enableDWARFDebugging = compose.enableDWARFDebugging;
/* Create a source distribution tarball like those found on hackage,
instead of building the package.
*/
sdistTarball = compose.sdistTarball;
/* Create a documentation tarball suitable for uploading to Hackage instead
of building the package.
*/
documentationTarball = compose.documentationTarball;
/* Use the gold linker. It is a linker for ELF that is designed
"to run as fast as possible on modern systems"
*/
linkWithGold = compose.linkWithGold;
/* link executables statically against haskell libs to reduce
closure size
*/
justStaticExecutables = compose.justStaticExecutables;
/* Build a source distribution tarball instead of using the source files
directly. The effect is that the package is built as if it were published
on hackage. This can be used as a test for the source distribution,
assuming the build fails when packaging mistakes are in the cabal file.
*/
buildFromSdist = compose.buildFromSdist;
/* Build the package in a strict way to uncover potential problems.
This includes buildFromSdist and failOnAllWarnings.
*/
buildStrictly = compose.buildStrictly;
/* Disable core optimizations, significantly speeds up build time */
disableOptimization = compose.disableOptimization;
/* Turn on most of the compiler warnings and fail the build if any
of them occur. */
failOnAllWarnings = compose.failOnAllWarnings;
/* Add a post-build check to verify that dependencies declared in
the cabal file are actually used.
The first attrset argument can be used to configure the strictness
of this check and a list of ignored package names that would otherwise
cause false alarms.
*/
checkUnusedPackages = compose.checkUnusedPackages;
buildStackProject = compose.buildStackProject;
/* Add a dummy command to trigger a build despite an equivalent
earlier build that is present in the store or cache.
*/
triggerRebuild = drv: i: compose.triggerRebuild i drv;
/* Override the sources for the package and optionaly the version.
This also takes of removing editedCabalFile.
*/
overrideSrc = drv: src: compose.overrideSrc src drv;
# Get all of the build inputs of a haskell package, divided by category.
getBuildInputs = compose.getBuildInputs;
# Extract the haskell build inputs of a haskell package.
# This is useful to build environments for developing on that
# package.
getHaskellBuildInputs = compose.getHaskellBuildInputs;
# Under normal evaluation, simply return the original package. Under
# nix-shell evaluation, return a nix-shell optimized environment.
shellAware = compose.shellAware;
ghcInfo = compose.ghcInfo;
### mkDerivation helpers
# These allow external users of a haskell package to extract
# information about how it is built in the same way that the
# generic haskell builder does, by reusing the same functions.
# Each function here has the same interface as mkDerivation and thus
# can be called for a given package simply by overriding the
# mkDerivation argument it used. See getHaskellBuildInputs above for
# an example of this.
# Some information about which phases should be run.
controlPhases = compose.controlPhases;
# Utility to convert a directory full of `cabal2nix`-generated files into a
# package override set
#
# packagesFromDirectory : { directory : Directory, ... } -> HaskellPackageOverrideSet
packagesFromDirectory = compose.packagesFromDirectory;
addOptparseApplicativeCompletionScripts = compose.addOptparseApplicativeCompletionScripts;
/*
Modify a Haskell package to add shell completion scripts for the
given executable produced by it. These completion scripts will be
picked up automatically if the resulting derivation is installed,
e.g. by `nix-env -i`.
Invocation:
generateOptparseApplicativeCompletions command pkg
command: name of an executable
pkg: Haskell package that builds the executables
*/
generateOptparseApplicativeCompletion = compose.generateOptparseApplicativeCompletion;
/*
Modify a Haskell package to add shell completion scripts for the
given executables produced by it. These completion scripts will be
picked up automatically if the resulting derivation is installed,
e.g. by `nix-env -i`.
Invocation:
generateOptparseApplicativeCompletions commands pkg
commands: name of an executable
pkg: Haskell package that builds the executables
*/
generateOptparseApplicativeCompletions = compose.generateOptparseApplicativeCompletions;
# Don't fail at configure time if there are multiple versions of the
# same package in the (recursive) dependencies of the package being
# built. Will delay failures, if any, to compile time.
allowInconsistentDependencies = compose.allowInconsistentDependencies;
}

View file

@ -0,0 +1,541 @@
# This expression takes a file like `hackage-packages.nix` and constructs
# a full package set out of that.
{ # package-set used for build tools (all of nixpkgs)
buildPackages
, # A haskell package set for Setup.hs, compiler plugins, and similar
# build-time uses.
buildHaskellPackages
, # package-set used for non-haskell dependencies (all of nixpkgs)
pkgs
, # stdenv provides our build and host platforms
stdenv
, # this module provides the list of known licenses and maintainers
lib
# needed for overrideCabal & packageSourceOverrides
, haskellLib
, # hashes for downloading Hackage packages
all-cabal-hashes
, # compiler to use
ghc
, # A function that takes `{ pkgs, lib, callPackage }` as the first arg and
# `self` as second, and returns a set of haskell packages
package-set
, # The final, fully overriden package set usable with the nixpkgs fixpoint
# overriding functionality
extensible-self
}:
# return value: a function from self to the package set
self:
let
inherit (stdenv) buildPlatform hostPlatform;
inherit (lib) fix' extends makeOverridable;
inherit (haskellLib) overrideCabal;
mkDerivationImpl = pkgs.callPackage ./generic-builder.nix {
inherit stdenv;
nodejs = buildPackages.nodejs-slim;
inherit (self) buildHaskellPackages ghc ghcWithHoogle ghcWithPackages;
inherit (self.buildHaskellPackages) jailbreak-cabal;
hscolour = overrideCabal (drv: {
isLibrary = false;
doHaddock = false;
hyperlinkSource = false; # Avoid depending on hscolour for this build.
postFixup = "rm -rf $out/lib $out/share $out/nix-support";
}) self.buildHaskellPackages.hscolour;
cpphs = overrideCabal (drv: {
isLibrary = false;
postFixup = "rm -rf $out/lib $out/share $out/nix-support";
}) (self.cpphs.overrideScope (self: super: {
mkDerivation = drv: super.mkDerivation (drv // {
enableSharedExecutables = false;
enableSharedLibraries = false;
doHaddock = false;
useCpphs = false;
});
}));
};
mkDerivation = makeOverridable mkDerivationImpl;
# manualArgs are the arguments that were explictly passed to `callPackage`, like:
#
# callPackage foo { bar = null; };
#
# here `bar` is a manual argument.
callPackageWithScope = scope: fn: manualArgs:
let
# this code is copied from callPackage in lib/customisation.nix
#
# we cannot use `callPackage` here because we want to call `makeOverridable`
# on `drvScope` (we cannot add `overrideScope` after calling `callPackage` because then it is
# lost on `.override`) but determine the auto-args based on `drv` (the problem here
# is that nix has no way to "passthrough" args while preserving the reflection
# info that callPackage uses to determine the arguments).
drv = if lib.isFunction fn then fn else import fn;
auto = builtins.intersectAttrs (lib.functionArgs drv) scope;
# Converts a returned function to a functor attribute set if necessary
ensureAttrs = v: if builtins.isFunction v then { __functor = _: v; } else v;
# this wraps the `drv` function to add a `overrideScope` function to the result.
drvScope = allArgs: ensureAttrs (drv allArgs) // {
overrideScope = f:
let newScope = mkScope (fix' (extends f scope.__unfix__));
# note that we have to be careful here: `allArgs` includes the auto-arguments that
# weren't manually specified. If we would just pass `allArgs` to the recursive call here,
# then we wouldn't look up any packages in the scope in the next interation, because it
# appears as if all arguments were already manually passed, so the scope change would do
# nothing.
in callPackageWithScope newScope drv manualArgs;
};
in lib.makeOverridable drvScope (auto // manualArgs);
mkScope = scope: let
ps = pkgs.__splicedPackages;
scopeSpliced = pkgs.splicePackages {
pkgsBuildBuild = scope.buildHaskellPackages.buildHaskellPackages;
pkgsBuildHost = scope.buildHaskellPackages;
pkgsBuildTarget = {};
pkgsHostHost = {};
pkgsHostTarget = scope;
pkgsTargetTarget = {};
} // {
# Don't splice these
inherit (scope) ghc buildHaskellPackages;
};
in ps // ps.xorg // ps.gnome2 // { inherit stdenv; } // scopeSpliced;
defaultScope = mkScope self;
callPackage = drv: args: callPackageWithScope defaultScope drv args;
# Use cabal2nix to create a default.nix for the package sources found at 'src'.
haskellSrc2nix = { name, src, sha256 ? null, extraCabal2nixOptions ? "" }:
let
sha256Arg = if sha256 == null then "--sha256=" else ''--sha256="${sha256}"'';
in buildPackages.runCommand "cabal2nix-${name}" {
nativeBuildInputs = [ buildPackages.cabal2nix-unwrapped ];
preferLocalBuild = true;
allowSubstitutes = false;
LANG = "en_US.UTF-8";
LOCALE_ARCHIVE = pkgs.lib.optionalString (buildPlatform.libc == "glibc") "${buildPackages.glibcLocales}/lib/locale/locale-archive";
} ''
export HOME="$TMP"
mkdir -p "$out"
cabal2nix --compiler=${self.ghc.haskellCompilerName} --system=${hostPlatform.config} ${sha256Arg} "${src}" ${extraCabal2nixOptions} > "$out/default.nix"
'';
all-cabal-hashes-component = name: version: buildPackages.runCommand "all-cabal-hashes-component-${name}-${version}" {} ''
tar --wildcards -xzvf ${all-cabal-hashes} \*/${name}/${version}/${name}.{json,cabal}
mkdir -p $out
mv */${name}/${version}/${name}.{json,cabal} $out
'';
hackage2nix = name: version: let component = all-cabal-hashes-component name version; in self.haskellSrc2nix {
name = "${name}-${version}";
sha256 = ''$(sed -e 's/.*"SHA256":"//' -e 's/".*$//' "${component}/${name}.json")'';
src = "${component}/${name}.cabal";
};
# Adds a nix file as an input to the haskell derivation it
# produces. This is useful for callHackage / callCabal2nix to
# prevent the generated default.nix from being garbage collected
# (requiring it to be frequently rebuilt), which can be an
# annoyance.
callPackageKeepDeriver = src: args:
overrideCabal (orig: {
preConfigure = ''
# Generated from ${src}
${orig.preConfigure or ""}
'';
passthru = orig.passthru or {} // {
# When using callCabal2nix or callHackage, it is often useful
# to debug a failure by inspecting the Nix expression
# generated by cabal2nix. This can be accessed via this
# cabal2nixDeriver field.
cabal2nixDeriver = src;
};
}) (self.callPackage src args);
in package-set { inherit pkgs lib callPackage; } self // {
inherit mkDerivation callPackage haskellSrc2nix hackage2nix buildHaskellPackages;
inherit (haskellLib) packageSourceOverrides;
# callHackage :: Text -> Text -> AttrSet -> HaskellPackage
#
# e.g., while overriding a package set:
# '... foo = self.callHackage "foo" "1.5.3" {}; ...'
callHackage = name: version: callPackageKeepDeriver (self.hackage2nix name version);
# callHackageDirect
# :: { pkg :: Text, ver :: Text, sha256 :: Text }
# -> AttrSet
# -> HaskellPackage
#
# This function does not depend on all-cabal-hashes and therefore will work
# for any version that has been released on hackage as opposed to only
# versions released before whatever version of all-cabal-hashes you happen
# to be currently using.
callHackageDirect = {pkg, ver, sha256}:
let pkgver = "${pkg}-${ver}";
in self.callCabal2nix pkg (pkgs.fetchzip {
url = "mirror://hackage/${pkgver}/${pkgver}.tar.gz";
inherit sha256;
});
# Creates a Haskell package from a source package by calling cabal2nix on the source.
callCabal2nixWithOptions = name: src: extraCabal2nixOptions: args:
let
filter = path: type:
pkgs.lib.hasSuffix ".cabal" path ||
baseNameOf path == "package.yaml";
expr = self.haskellSrc2nix {
inherit name extraCabal2nixOptions;
src = if pkgs.lib.canCleanSource src
then pkgs.lib.cleanSourceWith { inherit src filter; }
else src;
};
in overrideCabal (orig: {
inherit src;
}) (callPackageKeepDeriver expr args);
callCabal2nix = name: src: args: self.callCabal2nixWithOptions name src "" args;
# : { root : Path
# , name : Defaulted String
# , source-overrides : Defaulted (Either Path VersionNumber)
# , overrides : Defaulted (HaskellPackageOverrideSet)
# , modifier : Defaulted
# , returnShellEnv : Defaulted
# , withHoogle : Defaulted
# , cabal2nixOptions : Defaulted
# } -> NixShellAwareDerivation
#
# Given a path to a haskell package directory, an optional package name
# which defaults to the base name of the path, an optional set of source
# overrides as appropriate for the 'packageSourceOverrides' function, an
# optional set of arbitrary overrides, and an optional haskell package
# modifier, return a derivation appropriate for nix-build or nix-shell to
# build that package.
#
# If 'returnShellEnv' is true this returns a derivation which will give you
# an environment suitable for developing the listed packages with an
# incremental tool like cabal-install.
#
# If 'withHoogle' is true (the default if a shell environment is requested)
# then 'ghcWithHoogle' is used to generate the derivation (instead of
# 'ghcWithPackages'), see the documentation there for more information.
#
# 'cabal2nixOptions' can contain extra command line arguments to pass to
# 'cabal2nix' when generating the package derivation, for example setting
# a cabal flag with '--flag=myflag'.
developPackage =
{ root
, name ? if builtins.typeOf root == "path" then builtins.baseNameOf root else ""
, source-overrides ? {}
, overrides ? self: super: {}
, modifier ? drv: drv
, returnShellEnv ? pkgs.lib.inNixShell
, withHoogle ? returnShellEnv
, cabal2nixOptions ? "" }:
let drv =
(extensible-self.extend
(pkgs.lib.composeExtensions
(self.packageSourceOverrides source-overrides)
overrides))
.callCabal2nixWithOptions name root cabal2nixOptions {};
in if returnShellEnv
then (modifier drv).envFunc {inherit withHoogle;}
else modifier drv;
# This can be used to easily create a derivation containing GHC and the specified set of Haskell packages.
#
# Example:
# $ nix-shell -p 'haskellPackages.ghcWithPackages (hpkgs: [ hpkgs.mtl hpkgs.lens ])'
# $ ghci # in the nix-shell
# Prelude > import Control.Lens
#
# GHC is setup with a package database with all the specified Haskell packages.
#
# ghcWithPackages :: (HaskellPkgSet -> [ HaskellPkg ]) -> Derivation
ghcWithPackages = self.callPackage ./with-packages-wrapper.nix {
haskellPackages = self;
};
# Put 'hoogle' into the derivation's PATH with a database containing all
# the package's dependencies; run 'hoogle server --local' in a shell to
# host a search engine for the dependencies.
#
# Example usage:
# $ nix-shell -p 'haskellPackages.hoogleWithPackages (p: [ p.mtl p.lens ])'
# [nix-shell] $ hoogle server
#
# hoogleWithPackages :: (HaskellPkgSet -> [ HaskellPkg ]) -> Derivation
#
# To reload the Hoogle server automatically on .cabal file changes try
# this:
# echo *.cabal | entr -r -- nix-shell --run 'hoogle server --local'
hoogleWithPackages = self.callPackage ./hoogle.nix {
haskellPackages = self;
};
hoogleLocal =
{ packages ? [] }:
lib.warn "hoogleLocal is deprecated, use hoogleWithPackages instead" (
self.hoogleWithPackages (_: packages)
);
# This is like a combination of ghcWithPackages and hoogleWithPackages.
# It provides a derivation containing both GHC and Hoogle with an index of
# the given Haskell package database.
#
# Example:
# $ nix-shell -p 'haskellPackages.ghcWithHoogle (hpkgs: [ hpkgs.conduit hpkgs.lens ])'
#
# ghcWithHoogle :: (HaskellPkgSet -> [ HaskellPkg ]) -> Derivation
ghcWithHoogle = self.ghcWithPackages.override {
withHoogle = true;
};
# Returns a derivation whose environment contains a GHC with only
# the dependencies of packages listed in `packages`, not the
# packages themselves. Using nix-shell on this derivation will
# give you an environment suitable for developing the listed
# packages with an incremental tool like cabal-install.
#
# In addition to the "packages" arg and "withHoogle" arg, anything that
# can be passed into stdenv.mkDerivation can be included in the input attrset
#
# # default.nix
# with import <nixpkgs> {};
# haskellPackages.extend (haskell.lib.compose.packageSourceOverrides {
# frontend = ./frontend;
# backend = ./backend;
# common = ./common;
# })
#
# # shell.nix
# let pkgs = import <nixpkgs> {} in
# (import ./.).shellFor {
# packages = p: [p.frontend p.backend p.common];
# withHoogle = true;
# buildInputs = [ pkgs.python pkgs.cabal-install ];
# }
#
# -- cabal.project
# packages:
# frontend/
# backend/
# common/
#
# bash$ nix-shell --run "cabal new-build all"
# bash$ nix-shell --run "python"
shellFor =
{ # Packages to create this development shell for. These are usually
# your local packages.
packages
, # Whether or not to generate a Hoogle database for all the
# dependencies.
withHoogle ? false
, # Whether or not to include benchmark dependencies of your local
# packages. You should set this to true if you have benchmarks defined
# in your local packages that you want to be able to run with cabal benchmark
doBenchmark ? false
# An optional function that can modify the generic builder arguments
# for the fake package that shellFor uses to construct its environment.
#
# Example:
# let
# # elided...
# haskellPkgs = pkgs.haskell.packages.ghc884.override (hpArgs: {
# overrides = pkgs.lib.composeExtensions (hpArgs.overrides or (_: _: { })) (
# _hfinal: hprev: {
# mkDerivation = args: hprev.mkDerivation ({
# doCheck = false;
# doBenchmark = false;
# doHoogle = true;
# doHaddock = true;
# enableLibraryProfiling = false;
# enableExecutableProfiling = false;
# } // args);
# }
# );
# });
# in
# haskellPkgs.shellFor {
# packages = p: [ p.foo ];
# genericBuilderArgsModifier = args: args // { doCheck = true; doBenchmark = true };
# }
#
# This will disable tests and benchmarks for everything in "haskellPkgs"
# (which will invalidate the binary cache), and then re-enable them
# for the "shellFor" environment (ensuring that any test/benchmark
# dependencies for "foo" will be available within the nix-shell).
, genericBuilderArgsModifier ? (args: args)
# Extra dependencies, in the form of cabal2nix build attributes.
#
# An example use case is when you have Haskell scripts that use
# libraries that don't occur in your packages' dependencies.
#
# Example:
#
# extraDependencies = p: {
# libraryHaskellDepends = [ p.releaser ];
# };
, extraDependencies ? p: {}
, ...
} @ args:
let
# A list of the packages we want to build a development shell for.
# This is a list of Haskell package derivations.
selected = packages self;
# This is a list of attribute sets, where each attribute set
# corresponds to the build inputs of one of the packages input to shellFor.
#
# Each attribute has keys like buildDepends, executableHaskellDepends,
# testPkgconfigDepends, etc. The values for the keys of the attribute
# set are lists of dependencies.
#
# Example:
# cabalDepsForSelected
# => [
# # This may be the attribute set corresponding to the `backend`
# # package in the example above.
# { buildDepends = [ gcc ... ];
# libraryHaskellDepends = [ lens conduit ... ];
# ...
# }
# # This may be the attribute set corresponding to the `common`
# # package in the example above.
# { testHaskellDepends = [ tasty hspec ... ];
# libraryHaskellDepends = [ lens aeson ];
# benchmarkHaskellDepends = [ criterion ... ];
# ...
# }
# ...
# ]
cabalDepsForSelected = map (p: p.getCabalDeps) selected;
# A predicate that takes a derivation as input, and tests whether it is
# the same as any of the `selected` packages.
#
# Returns true if the input derivation is not in the list of `selected`
# packages.
#
# isNotSelected :: Derivation -> Bool
#
# Example:
#
# isNotSelected common [ frontend backend common ]
# => false
#
# isNotSelected lens [ frontend backend common ]
# => true
isNotSelected = input: pkgs.lib.all (p: input.outPath or null != p.outPath) selected;
# A function that takes a list of list of derivations, filters out all
# the `selected` packages from each list, and concats the results.
#
# zipperCombinedPkgs :: [[Derivation]] -> [Derivation]
#
# Example:
# zipperCombinedPkgs [ [ lens conduit ] [ aeson frontend ] ]
# => [ lens conduit aeson ]
#
# Note: The reason this isn't just the function `pkgs.lib.concat` is
# that we need to be careful to remove dependencies that are in the
# `selected` packages.
#
# For instance, in the above example, if `common` is a dependency of
# `backend`, then zipperCombinedPkgs needs to be careful to filter out
# `common`, because cabal will end up ignoring that built version,
# assuming new-style commands.
zipperCombinedPkgs = vals:
pkgs.lib.concatMap
(drvList: pkgs.lib.filter isNotSelected drvList)
vals;
# Zip `cabalDepsForSelected` into a single attribute list, combining
# the derivations in all the individual attributes.
#
# Example:
# packageInputs
# => # Assuming the value of cabalDepsForSelected is the same as
# # the example in cabalDepsForSelected:
# { buildDepends = [ gcc ... ];
# libraryHaskellDepends = [ lens conduit aeson ... ];
# testHaskellDepends = [ tasty hspec ... ];
# benchmarkHaskellDepends = [ criterion ... ];
# ...
# }
#
# See the Note in `zipperCombinedPkgs` for what gets filtered out from
# each of these dependency lists.
packageInputs =
pkgs.lib.zipAttrsWith (_name: zipperCombinedPkgs) (cabalDepsForSelected ++ [ (extraDependencies self) ]);
# A attribute set to pass to `haskellPackages.mkDerivation`.
#
# The important thing to note here is that all the fields from
# packageInputs are set correctly.
genericBuilderArgs = {
pname =
if pkgs.lib.length selected == 1
then (pkgs.lib.head selected).name
else "packages";
version = "0";
license = null;
}
// packageInputs
// pkgs.lib.optionalAttrs doBenchmark {
# `doBenchmark` needs to explicitly be set here because haskellPackages.mkDerivation defaults it to `false`. If the user wants benchmark dependencies included in their development shell, it has to be explicitly enabled here.
doBenchmark = true;
};
# This is a pseudo Haskell package derivation that contains all the
# dependencies for the packages in `selected`.
#
# This is a derivation created with `haskellPackages.mkDerivation`.
#
# pkgWithCombinedDeps :: HaskellDerivation
pkgWithCombinedDeps = self.mkDerivation (genericBuilderArgsModifier genericBuilderArgs);
# The derivation returned from `envFunc` for `pkgWithCombinedDeps`.
#
# This is a derivation that can be run with `nix-shell`. It provides a
# GHC with a package database with all the dependencies of our
# `selected` packages.
#
# This is a derivation created with `stdenv.mkDerivation` (not
# `haskellPackages.mkDerivation`).
#
# pkgWithCombinedDepsDevDrv :: Derivation
pkgWithCombinedDepsDevDrv = pkgWithCombinedDeps.envFunc { inherit withHoogle; };
mkDerivationArgs = builtins.removeAttrs args [ "genericBuilderArgsModifier" "packages" "withHoogle" "doBenchmark" "extraDependencies" ];
in pkgWithCombinedDepsDevDrv.overrideAttrs (old: mkDerivationArgs // {
nativeBuildInputs = old.nativeBuildInputs ++ mkDerivationArgs.nativeBuildInputs or [];
buildInputs = old.buildInputs ++ mkDerivationArgs.buildInputs or [];
});
ghc = ghc // {
withPackages = self.ghcWithPackages;
withHoogle = self.ghcWithHoogle;
};
}

View file

@ -0,0 +1,41 @@
# EXTRA HASKELL PACKAGES NOT ON HACKAGE
#
# This file should only contain packages that are not in ./hackage-packages.nix.
# Attributes in this set should be nothing more than a callPackage call.
# Overrides to these packages should go to either configuration-nix.nix,
# configuration-common.nix or to one of the compiler specific configuration
# files.
self: super: {
dconf2nix = self.callPackage ../tools/haskell/dconf2nix/dconf2nix.nix { };
ldgallery-compiler = self.callPackage ../../tools/graphics/ldgallery/compiler { };
# Used by maintainers/scripts/regenerate-hackage-packages.sh, and generated
# from the latest master instead of the current version on Hackage.
cabal2nix-unstable = self.callPackage ./cabal2nix-unstable.nix { };
# https://github.com/channable/vaultenv/issues/1
vaultenv = self.callPackage ../tools/haskell/vaultenv { };
# spago is not released to Hackage.
# https://github.com/spacchetti/spago/issues/512
spago = self.callPackage ../tools/purescript/spago/spago.nix { };
nix-linter = self.callPackage ../../development/tools/analysis/nix-linter { };
# hasura graphql-engine is not released to hackage.
# https://github.com/hasura/graphql-engine/issues/7391
ci-info = self.callPackage ../misc/haskell/hasura/ci-info.nix {};
pg-client = self.callPackage ../misc/haskell/hasura/pg-client.nix {};
graphql-parser = self.callPackage ../misc/haskell/hasura/graphql-parser.nix {};
graphql-engine = self.callPackage ../misc/haskell/hasura/graphql-engine.nix {};
kriti-lang = self.callPackage ../misc/haskell/hasura/kriti-lang.nix {};
hasura-resource-pool = self.callPackage ../misc/haskell/hasura/pool.nix {};
hasura-ekg-core = self.callPackage ../misc/haskell/hasura/ekg-core.nix {};
hasura-ekg-json = self.callPackage ../misc/haskell/hasura/ekg-json.nix {};
# Unofficial fork until PRs are merged https://github.com/pcapriotti/optparse-applicative/pulls/roberth
# cabal2nix --maintainer roberth https://github.com/hercules-ci/optparse-applicative.git > pkgs/development/misc/haskell/hercules-ci-optparse-applicative.nix
hercules-ci-optparse-applicative = self.callPackage ../misc/haskell/hercules-ci-optparse-applicative.nix {};
}

View file

@ -0,0 +1,25 @@
{ runCommand, haskellPackages, lib, all-cabal-hashes, writeShellScript }:
let
# Checks if the version looks like a Haskell PVP version which is the format
# Hackage enforces. This will return false if the version strings is empty or
# we've overridden the package to ship an unstable version of the package
# (sadly there's no good way to show something useful on hackage in this case).
isPvpVersion = v: builtins.match "([0-9]+)(\\.[0-9]+)*" v != null;
pkgLine = name: pkg:
let
version = pkg.version or "";
in
if isPvpVersion version then
''"${name}","${version}","http://hydra.nixos.org/job/nixpkgs/trunk/haskellPackages.${name}.x86_64-linux"''
else "";
all-haskellPackages = builtins.toFile "all-haskellPackages" (lib.concatStringsSep "\n" (lib.filter (x: x != "") (lib.mapAttrsToList pkgLine haskellPackages)));
in
runCommand "hackage-package-list" { }
# This command will make a join between all packages on hackage and haskellPackages.*.
# It creates a valid csv file which can be uploaded to hackage.haskell.org.
# The call is wrapped in echo $(...) to trim trailing newline, which hackage requires.
''
mkdir -p $out/bin
echo -n "$(tar -t -f ${all-cabal-hashes} | sed 's![^/]*/\([^/]*\)/.*!"\1"!' | sort -u | join -t , - ${all-haskellPackages})" > $out/nixos-hackage-packages.csv
''

View file

@ -0,0 +1,12 @@
diff --git a/GLUT.cabal b/GLUT.cabal
index f370d6c..a404e1e 100644
--- a/GLUT.cabal
+++ b/GLUT.cabal
@@ -103,6 +103,7 @@ library
else
cpp-options: "-DCALLCONV=ccall"
cc-options: "-DUSE_DLSYM"
+ pkgconfig-depends: glut
executable BOGLGP01-OnYourOwn1
if !flag(BuildExamples)

View file

@ -0,0 +1,9 @@
--- SDL-image-0.6.2.0/Graphics/UI/SDL/Image/Version.hsc.orig 2021-08-06 01:21:05.000000000 +0200
+++ SDL-image-0.6.2.0/Graphics/UI/SDL/Image/Version.hsc 2021-08-06 01:21:56.000000000 +0200
@@ -1,4 +1,6 @@
#include "SDL_image.h"
+-- override SDL_main.h redefining main to SDL_main on darwin
+#define main main
module Graphics.UI.SDL.Image.Version
( compiledFor
, linkedWith

View file

@ -0,0 +1,9 @@
--- SDL-ttf-0.6.3.0/Graphics/UI/SDL/TTF/Version.hsc.orig 2021-08-06 01:31:39.000000000 +0200
+++ SDL-ttf-0.6.3.0/Graphics/UI/SDL/TTF/Version.hsc 2021-08-06 01:32:03.000000000 +0200
@@ -1,4 +1,6 @@
#include "SDL_ttf.h"
+-- override SDL_main.h redefining main to SDL_main on darwin
+#define main main
module Graphics.UI.SDL.TTF.Version
( compiledFor
, linkedWith

View file

@ -0,0 +1,24 @@
From 657b70d174fe5cb61e56cb8b9c5e57f1ec216f2b Mon Sep 17 00:00:00 2001
From: Mikhail Glushenkov <mikhail.glushenkov@gmail.com>
Date: Wed, 10 Apr 2019 17:42:57 +0100
Subject: [PATCH] Allow http-client 0.6.*.
Changelog doesn't list any silently breaking semantic changes.
---
amazonka/amazonka.cabal | 2 +-
core/amazonka-core.cabal | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/amazonka/amazonka.cabal b/amazonka/amazonka.cabal
index e86713f11c..81c4cb7e48 100644
--- a/amazonka.cabal
+++ b/amazonka.cabal
@@ -67,7 +67,7 @@ library
, conduit-extra >= 1.1
, directory >= 1.2
, exceptions >= 0.6
- , http-client >= 0.4 && < 0.6
+ , http-client >= 0.4 && < 0.7
, http-conduit >= 2.1.7 && < 3
, http-types >= 0.8
, ini >= 0.3.5

View file

@ -0,0 +1,26 @@
From 657b70d174fe5cb61e56cb8b9c5e57f1ec216f2b Mon Sep 17 00:00:00 2001
From: Mikhail Glushenkov <mikhail.glushenkov@gmail.com>
Date: Wed, 10 Apr 2019 17:42:57 +0100
Subject: [PATCH] Allow http-client 0.6.*.
Changelog doesn't list any silently breaking semantic changes.
---
amazonka/amazonka.cabal | 2 +-
core/amazonka-core.cabal | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/core/amazonka-core.cabal b/core/amazonka-core.cabal
index 9796e007cf..eccb24e5bd 100644
--- a/amazonka-core.cabal
+++ b/amazonka-core.cabal
@@ -90,7 +90,7 @@ library
, deepseq >= 1.4
, exceptions >= 0.6
, hashable >= 1.2
- , http-client >= 0.4 && < 0.6
+ , http-client >= 0.4 && < 0.7
, http-conduit >= 2.1.4 && < 3
, http-types >= 0.8 && (<0.11 || >=0.12)
, lens >= 4.4
--
2.23.0

View file

@ -0,0 +1,28 @@
From 35d972b3dc5056110d55315f2256d9c5046299c7 Mon Sep 17 00:00:00 2001
From: Peter Simons <simons@cryp.to>
Date: Tue, 1 Sep 2015 17:58:36 +0200
Subject: [PATCH] Revert "Fix maximum sizing calculation."
This reverts commit 44b01ba38b4fcdb5a85f44fa2f3af1f29cde8f40. The change breaks
this package on 32 bit platforms. See https://github.com/bos/bloomfilter/issues/7
for further details.
---
Data/BloomFilter/Easy.hs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Data/BloomFilter/Easy.hs b/Data/BloomFilter/Easy.hs
index 5143c6e..a349168 100644
--- a/Data/BloomFilter/Easy.hs
+++ b/Data/BloomFilter/Easy.hs
@@ -72,7 +72,7 @@ safeSuggestSizing capacity errRate
minimum [((-k) * cap / log (1 - (errRate ** (1 / k))), k)
| k <- [1..100]]
roundedBits = nextPowerOfTwo (ceiling bits)
- in if roundedBits <= 0 || roundedBits > 0xffffffff
+ in if roundedBits <= 0
then Left "capacity too large to represent"
else Right (roundedBits, truncate hashes)
--
2.5.1

View file

@ -0,0 +1,69 @@
diff --git a/Crypto/KDF/Argon2.hs b/Crypto/KDF/Argon2.hs
index 044ba00..31dc6f1 100644
--- a/Crypto/KDF/Argon2.hs
+++ b/Crypto/KDF/Argon2.hs
@@ -12,6 +12,7 @@
-- File started from Argon2.hs, from Oliver Charles
-- at https://github.com/ocharles/argon2
--
+{-# LANGUAGE DataKinds #-}
module Crypto.KDF.Argon2
(
Options(..)
@@ -32,6 +33,7 @@ import Control.Monad (when)
import Data.Word
import Foreign.C
import Foreign.Ptr
+import Data.Proxy
-- | Which variant of Argon2 to use. You should choose the variant that is most
-- applicable to your intention to hash inputs.
@@ -100,33 +102,12 @@ defaultOptions =
}
hash :: (ByteArrayAccess password, ByteArrayAccess salt, ByteArray out)
- => Options
+ => [Proxy "cryptonite:Crypto.KDF.Argon2.hash is known to be broken on this architecture. See https://github.com/haskell-crypto/cryptonite/issues/360"]
-> password
-> salt
-> Int
-> CryptoFailable out
-hash options password salt outLen
- | saltLen < saltMinLength = CryptoFailed CryptoError_SaltTooSmall
- | outLen < outputMinLength = CryptoFailed CryptoError_OutputLengthTooSmall
- | outLen > outputMaxLength = CryptoFailed CryptoError_OutputLengthTooBig
- | otherwise = CryptoPassed $ B.allocAndFreeze outLen $ \out -> do
- res <- B.withByteArray password $ \pPass ->
- B.withByteArray salt $ \pSalt ->
- argon2_hash (iterations options)
- (memory options)
- (parallelism options)
- pPass
- (csizeOfInt passwordLen)
- pSalt
- (csizeOfInt saltLen)
- out
- (csizeOfInt outLen)
- (cOfVariant $ variant options)
- (cOfVersion $ version options)
- when (res /= 0) $ error "argon2: hash: internal error"
- where
- saltLen = B.length salt
- passwordLen = B.length password
+hash options password salt outLen = error "cryptonite:Crypto.KDF.Argon2.hash is known to be broken on this architecture. See https://github.com/haskell-crypto/cryptonite/issues/360"
data Pass
data Salt
diff --git a/tests/KAT_Argon2.hs b/tests/KAT_Argon2.hs
index a347fc5..fdba079 100644
--- a/tests/KAT_Argon2.hs
+++ b/tests/KAT_Argon2.hs
@@ -32,7 +32,7 @@ kdfTests = zipWith toKDFTest is vectors
where
toKDFTest i v =
testCase (show i)
- (CryptoPassed (kdfResult v) @=? Argon2.hash (kdfOptions v) (kdfPass v) (kdfSalt v) (B.length $ kdfResult v))
+ (pure ())
is :: [Int]
is = [1..]

View file

@ -0,0 +1,333 @@
From 2490fa65eeba52699a7c0e303aa5cb9b78c2b1cf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= <mail@nh2.me>
Date: Fri, 17 Apr 2020 20:49:23 +0200
Subject: [PATCH] Compile against GHC 8.8
---
Setup.hs | 15 ---------------
src/Darcs/Patch/Depends.hs | 2 +-
src/Darcs/Patch/Match.hs | 12 ++++++------
src/Darcs/Patch/PatchInfoAnd.hs | 2 +-
src/Darcs/Patch/Prim/V1/Apply.hs | 6 +++---
src/Darcs/Patch/Prim/V1/Commute.hs | 1 +
src/Darcs/Patch/ReadMonads.hs | 1 +
src/Darcs/Patch/V1/Commute.hs | 1 +
src/Darcs/Repository/Diff.hs | 2 +-
src/Darcs/Repository/Match.hs | 2 +-
src/Darcs/Util/Tree/Monad.hs | 4 ++--
12 files changed, 30 insertions(+), 42 deletions(-)
diff --git a/Setup.hs b/Setup.hs
index f5cc3e8..05caac4 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -75,21 +75,6 @@
postInst = \ _ flags pkg lbi ->
installManpage pkg lbi (fromFlag $ installVerbosity flags) NoCopyDest,
- sDistHook = \ pkg lbi hooks flags -> do
- let pkgVer = packageVersion pkg
- verb = fromFlag $ sDistVerbosity flags
- x <- versionPatches verb pkgVer
- y <- context verb
- rewriteFileEx silent "release/distributed-version" $ show x
- rewriteFileEx silent "release/distributed-context" $ show y
- putStrLn "about to hand over"
- let pkg' = pkg { library = sanity (library pkg) }
- sanity (Just lib) = Just $ lib { libBuildInfo = sanity' $ libBuildInfo lib }
- sanity _ = error "eh"
- sanity' bi = bi { otherModules = [ m | m <- otherModules bi, toFilePath m /= "Version" ] }
-
- sDistHook simpleUserHooks pkg' lbi hooks flags
- ,
postConf = \_ _ _ _ -> return () --- Usually this checked for external C
--- dependencies, but we already have performed such
--- check in the confHook
--- a/darcs.cabal 1970-01-01 01:00:01.000000000 +0100
+++ b/darcs.cabal 2020-04-18 10:26:07.605129733 +0200
@@ -1,6 +1,5 @@
Name: darcs
version: 2.14.2
-x-revision: 1
License: GPL-2
License-file: COPYING
Author: David Roundy <droundy@darcs.net>, <darcs-devel@darcs.net>
@@ -75,7 +74,7 @@
description: Use libcurl for HTTP support.
-- in future this could extend to any other external libraries,
--- e.g. libiconv
+-- e.g. libiconv
flag pkgconfig
description: Use pkgconfig to configure libcurl
default: False
@@ -113,7 +112,7 @@
-- ----------------------------------------------------------------------
custom-setup
- setup-depends: base >= 4.9 && < 4.13,
+ setup-depends: base >= 4.9 && <5,
Cabal >= 1.24,
process >= 1.2.3.0 && < 1.7,
filepath >= 1.4.1 && < 1.5.0.0,
@@ -381,7 +380,7 @@
else
build-depends: unix >= 2.7.1.0 && < 2.8
- build-depends: base >= 4.9 && < 4.13,
+ build-depends: base >= 4.9 && <5,
stm >= 2.1 && < 2.6,
binary >= 0.5 && < 0.10,
containers >= 0.5.6.2 && < 0.7,
@@ -402,19 +401,19 @@
tar >= 0.5 && < 0.6,
data-ordlist == 0.4.*,
attoparsec >= 0.13.0.1 && < 0.14,
- zip-archive >= 0.3 && < 0.5,
+ zip-archive >= 0.3 && <1,
async >= 2.0.2 && < 2.3,
- sandi >= 0.4 && < 0.6,
+ sandi >= 0.4 && <1,
unix-compat >= 0.4.2 && < 0.6,
bytestring >= 0.10.6 && < 0.11,
old-time >= 1.1.0.3 && < 1.2,
time >= 1.5.0.1 && < 1.10,
- text >= 1.2.1.3 && < 1.3,
+ text >= 1.2.1.3 && <2,
directory >= 1.2.6.2 && < 1.4,
process >= 1.2.3.0 && < 1.7,
array >= 0.5.1.0 && < 0.6,
random >= 1.1 && < 1.2,
- hashable >= 1.2.3.3 && < 1.3,
+ hashable >= 1.2.3.3 && <2,
mmap >= 0.5.9 && < 0.6,
zlib >= 0.6.1.2 && < 0.7.0.0,
network-uri == 2.6.*,
@@ -443,7 +442,7 @@
-- The terminfo package cannot be built on Windows.
if flag(terminfo) && !os(windows)
- build-depends: terminfo >= 0.4.0.2 && < 0.5
+ build-depends: terminfo >= 0.4.0.2 && <1
cpp-options: -DHAVE_TERMINFO
default-extensions:
@@ -500,7 +499,7 @@
cc-options: -D_REENTRANT
build-depends: darcs,
- base >= 4.9 && < 4.13
+ base >= 4.9 && <5
-- ----------------------------------------------------------------------
-- unit test driver
@@ -518,7 +517,7 @@
build-depends: Win32 >= 2.3.1 && < 2.4
build-depends: darcs,
- base >= 4.9 && < 4.13,
+ base >= 4.9 && <5,
array >= 0.5.1.0 && < 0.6,
bytestring >= 0.10.6 && < 0.11,
cmdargs >= 0.10.10 && < 0.11,
@@ -527,15 +526,15 @@
mtl >= 2.2.1 && < 2.3,
shelly >= 1.6.8 && < 1.9,
split >= 0.2.2 && < 0.3,
- text >= 1.2.1.3 && < 1.3,
+ text >= 1.2.1.3 && <2,
directory >= 1.2.6.2 && < 1.4,
FindBin >= 0.0.5 && < 0.1,
- QuickCheck >= 2.8.2 && < 2.13,
+ QuickCheck >= 2.8.2 && <3,
HUnit >= 1.3 && < 1.7,
test-framework >= 0.8.1.1 && < 0.9,
test-framework-hunit >= 0.3.0.2 && < 0.4,
test-framework-quickcheck2 >= 0.3.0.3 && < 0.4,
- zip-archive >= 0.3 && < 0.5
+ zip-archive >= 0.3 && <1
-- https://github.com/yesodweb/Shelly.hs/issues/177
if os(windows)
diff --git a/src/Darcs/Patch/Depends.hs b/src/Darcs/Patch/Depends.hs
index 8531294..a4c71cb 100644
--- a/src/Darcs/Patch/Depends.hs
+++ b/src/Darcs/Patch/Depends.hs
@@ -251,7 +251,7 @@ splitOnTag _ (PatchSet NilRL NilRL) = Nothing
unwrapOneTagged :: (Monad m) => PatchSet rt p wX wY -> m (PatchSet rt p wX wY)
unwrapOneTagged (PatchSet (ts :<: Tagged t _ tps) ps) =
return $ PatchSet ts (tps :<: t +<+ ps)
-unwrapOneTagged _ = fail "called unwrapOneTagged with no Tagged's in the set"
+unwrapOneTagged _ = error "called unwrapOneTagged with no Tagged's in the set"
-- | @getUncovered ps@ returns the 'PatchInfo' for all the patches in
-- @ps@ that are not depended on by anything else *through explicit
diff --git a/src/Darcs/Patch/Match.hs b/src/Darcs/Patch/Match.hs
index aba6c7a..2b6f53a 100644
--- a/src/Darcs/Patch/Match.hs
+++ b/src/Darcs/Patch/Match.hs
@@ -421,7 +421,7 @@ getNonrangeMatchS fs repo =
Just m -> if nonrangeMatcherIsTag fs
then getTagS m repo
else getMatcherS Exclusive m repo
- Nothing -> fail "Pattern not specified in getNonrangeMatch."
+ Nothing -> error "Pattern not specified in getNonrangeMatch."
-- | @firstMatch fs@ tells whether @fs@ implies a "first match", that
-- is if we match against patches from a point in the past on, rather
@@ -441,7 +441,7 @@ getFirstMatchS fs repo =
Just (_,b) -> unpullLastN repo b -- b is chronologically earlier than a
Nothing ->
case firstMatcher fs of
- Nothing -> fail "Pattern not specified in getFirstMatchS."
+ Nothing -> error "Pattern not specified in getFirstMatchS."
Just m -> if firstMatcherIsTag fs
then getTagS m repo
else getMatcherS Inclusive m repo
@@ -462,7 +462,7 @@ checkMatchSyntax :: [MatchFlag] -> IO ()
checkMatchSyntax opts =
case getMatchPattern opts of
Nothing -> return ()
- Just p -> either fail (const $ return ()) (parseMatch p::Either String (MatchFun rt DummyPatch))
+ Just p -> either error (const $ return ()) (parseMatch p::Either String (MatchFun rt DummyPatch))
getMatchPattern :: [MatchFlag] -> Maybe String
getMatchPattern [] = Nothing
@@ -718,7 +718,7 @@ getMatcherS :: (ApplyMonad (ApplyState p) m, Matchable p) =>
getMatcherS ioe m repo =
if matchExists m repo
then applyInvToMatcher ioe m repo
- else fail $ "Couldn't match pattern "++ show m
+ else error $ "Couldn't match pattern "++ show m
getTagS :: (ApplyMonad (ApplyState p) m, MonadProgress m, Matchable p) =>
Matcher rt p -> PatchSet rt p Origin wX -> m ()
diff --git a/src/Darcs/Patch/PatchInfoAnd.hs b/src/Darcs/Patch/PatchInfoAnd.hs
index 2da7ec8..1147410 100644
--- a/src/Darcs/Patch/PatchInfoAnd.hs
+++ b/src/Darcs/Patch/PatchInfoAnd.hs
@@ -167,7 +167,7 @@ conscientiously er (PIAP pinf hp) =
-- | @hopefullyM@ is a version of @hopefully@ which calls @fail@ in a
-- monad instead of erroring.
-hopefullyM :: Monad m => PatchInfoAnd rt p wA wB -> m (WrappedNamed rt p wA wB)
+hopefullyM :: MonadFail m => PatchInfoAnd rt p wA wB -> m (WrappedNamed rt p wA wB)
hopefullyM (PIAP pinf hp) = case hopefully2either hp of
Right p -> return p
Left e -> fail $ renderString
diff --git a/src/Darcs/Patch/Prim/V1/Apply.hs b/src/Darcs/Patch/Prim/V1/Apply.hs
index bea7e41..7984d21 100644
--- a/src/Darcs/Patch/Prim/V1/Apply.hs
+++ b/src/Darcs/Patch/Prim/V1/Apply.hs
@@ -41,13 +41,13 @@ instance Apply Prim where
apply (FP f (TokReplace t o n)) = mModifyFilePS f doreplace
where doreplace fc =
case tryTokReplace t (BC.pack o) (BC.pack n) fc of
- Nothing -> fail $ "replace patch to " ++ fn2fp f
+ Nothing -> error $ "replace patch to " ++ fn2fp f
++ " couldn't apply."
Just fc' -> return fc'
apply (FP f (Binary o n)) = mModifyFilePS f doapply
where doapply oldf = if o == oldf
then return n
- else fail $ "binary patch to " ++ fn2fp f
+ else error $ "binary patch to " ++ fn2fp f
++ " couldn't apply."
apply (DP d AddDir) = mCreateDirectory d
apply (DP d RmDir) = mRemoveDirectory d
@@ -115,7 +115,7 @@ applyHunk f h fc =
case applyHunkLines h fc of
Right fc' -> return fc'
Left msg ->
- fail $
+ error $
"### Error applying:\n" ++ renderHunk h ++
"\n### to file " ++ fn2fp f ++ ":\n" ++ BC.unpack fc ++
"### Reason: " ++ msg
diff --git a/src/Darcs/Patch/Prim/V1/Commute.hs b/src/Darcs/Patch/Prim/V1/Commute.hs
index 7639dbd..e1432e6 100644
--- a/src/Darcs/Patch/Prim/V1/Commute.hs
+++ b/src/Darcs/Patch/Prim/V1/Commute.hs
@@ -58,6 +58,7 @@ instance Monad Perhaps where
Failed >>= _ = Failed
Unknown >>= _ = Unknown
return = Succeeded
+instance MonadFail Perhaps where
fail _ = Unknown
instance Alternative Perhaps where
diff --git a/src/Darcs/Patch/ReadMonads.hs b/src/Darcs/Patch/ReadMonads.hs
index 62a4f81..e1cb149 100644
--- a/src/Darcs/Patch/ReadMonads.hs
+++ b/src/Darcs/Patch/ReadMonads.hs
@@ -237,6 +237,7 @@ failSM _ = SM (\_ -> Nothing)
instance Monad SM where
(>>=) = bindSM
return = returnSM
+instance MonadFail SM where
fail = failSM
instance ParserM SM where
diff --git a/src/Darcs/Patch/V1/Commute.hs b/src/Darcs/Patch/V1/Commute.hs
index 0bb41a3..c6c3382 100644
--- a/src/Darcs/Patch/V1/Commute.hs
+++ b/src/Darcs/Patch/V1/Commute.hs
@@ -93,6 +93,7 @@ instance Monad Perhaps where
Failed >>= _ = Failed
Unknown >>= _ = Unknown
return = Succeeded
+instance MonadFail Perhaps where
fail _ = Unknown
instance Alternative Perhaps where
diff --git a/src/Darcs/Repository/Diff.hs b/src/Darcs/Repository/Diff.hs
index 8078d49..e0e2341 100644
--- a/src/Darcs/Repository/Diff.hs
+++ b/src/Darcs/Repository/Diff.hs
@@ -138,7 +138,7 @@ treeDiff da ft t1 t2 = do
do rmDirP <- diff p (Removed subtree)
addFileP <- diff p (Changed (File emptyBlob) b')
return $ joinGap (+>+) rmDirP addFileP
- diff p _ = fail $ "Missing case at path " ++ show p
+ diff p _ = error $ "Missing case at path " ++ show p
text_diff p a b
| BL.null a && BL.null b = emptyGap NilFL
diff --git a/src/Darcs/Repository/Match.hs b/src/Darcs/Repository/Match.hs
index 08c9f13..f33cabe 100644
--- a/src/Darcs/Repository/Match.hs
+++ b/src/Darcs/Repository/Match.hs
@@ -60,7 +60,7 @@ getNonrangeMatch :: (ApplyMonad (ApplyState p) DefaultIO, IsRepoType rt, RepoPat
getNonrangeMatch r = withRecordedMatch r . getMatch where
getMatch fs = case hasIndexRange fs of
Just (n, m) | n == m -> applyNInv (n-1)
- | otherwise -> fail "Index range is not allowed for this command."
+ | otherwise -> error "Index range is not allowed for this command."
_ -> getNonrangeMatchS fs
getOnePatchset :: (IsRepoType rt, RepoPatch p)
diff --git a/src/Darcs/Util/Tree/Monad.hs b/src/Darcs/Util/Tree/Monad.hs
index 0e01d9b..296fdc4 100644
--- a/src/Darcs/Util/Tree/Monad.hs
+++ b/src/Darcs/Util/Tree/Monad.hs
@@ -216,7 +216,7 @@ instance (Monad m) => TreeRO (TreeMonad m) where
t <- gets tree
let f = findFile t p'
case f of
- Nothing -> fail $ "No such file " ++ show p'
+ Nothing -> error $ "No such file " ++ show p'
Just x -> lift (readBlob x)
currentDirectory = ask
@@ -251,7 +251,7 @@ instance (Monad m) => TreeRW (TreeMonad m) where
let item = find tr from'
found_to = find tr to'
unless (isNothing found_to) $
- fail $ "Error renaming: destination " ++ show to ++ " exists."
+ error $ "Error renaming: destination " ++ show to ++ " exists."
unless (isNothing item) $ do
modifyItem from Nothing
modifyItem to item
--
2.23.1

View file

@ -0,0 +1,120 @@
--- darcs-2.14.2/Setup.hs 2019-01-27 03:14:51.000000000 +1300
+++ darcs.net/Setup.hs 2019-10-18 02:41:57.000000000 +1300
@@ -11,7 +11,9 @@
, TestSuite(testBuildInfo)
, updatePackageDescription
, cppOptions, ccOptions
- , library, libBuildInfo, otherModules )
+ , library, libBuildInfo, otherModules
+ , ComponentName(CExeName)
+ )
import Distribution.Package
( packageVersion )
import Distribution.Version( Version )
@@ -21,24 +23,27 @@
import Distribution.Simple.Setup
(buildVerbosity, copyDest, copyVerbosity, fromFlag,
haddockVerbosity, installVerbosity, sDistVerbosity, replVerbosity )
-import Distribution.Simple.BuildPaths ( autogenModulesDir )
+import Distribution.Simple.BuildPaths ( autogenPackageModulesDir )
import Distribution.System
( OS(Windows), buildOS )
import Distribution.Simple.Utils
(copyFiles, createDirectoryIfMissingVerbose, rawSystemStdout,
- rewriteFile )
+ rewriteFileEx)
+import Distribution.Types.UnqualComponentName
import Distribution.Verbosity
- ( Verbosity )
+ ( Verbosity, silent )
import Distribution.Text
( display )
-import Control.Monad ( unless, void )
+import Control.Monad ( unless, when, void )
import System.Directory
( doesDirectoryExist, doesFileExist )
import System.IO
( openFile, IOMode(..) )
import System.Process (runProcess)
import Data.List( isInfixOf, lines )
+import qualified Data.Map as M
+import Data.Maybe ( isJust )
import System.FilePath ( (</>) )
import Foreign.Marshal.Utils ( with )
import Foreign.Storable ( peek )
@@ -75,8 +80,8 @@
verb = fromFlag $ sDistVerbosity flags
x <- versionPatches verb pkgVer
y <- context verb
- rewriteFile "release/distributed-version" $ show x
- rewriteFile "release/distributed-context" $ show y
+ rewriteFileEx silent "release/distributed-version" $ show x
+ rewriteFileEx silent "release/distributed-context" $ show y
putStrLn "about to hand over"
let pkg' = pkg { library = sanity (library pkg) }
sanity (Just lib) = Just $ lib { libBuildInfo = sanity' $ libBuildInfo lib }
@@ -105,8 +110,7 @@
littleEndian <- testEndianness
let args = ("-DPACKAGE_VERSION=" ++ show' version) :
[arg | (arg, True) <- -- include fst iff snd.
- [-- We have MAPI iff building on/for Windows.
- ("-DHAVE_MAPI", buildOS == Windows),
+ [
("-DLITTLEENDIAN", littleEndian),
("-DBIGENDIAN", not littleEndian)]]
bi = emptyBuildInfo { cppOptions = args, ccOptions = args }
@@ -133,20 +137,26 @@
-- man page
-- ---------------------------------------------------------------------
+hasDarcsExe :: LocalBuildInfo -> Bool
+hasDarcsExe = isJust . M.lookup darcsExe . componentNameMap where
+ darcsExe = CExeName (mkUnqualComponentName "darcs")
+
buildManpage :: LocalBuildInfo -> IO ()
-buildManpage lbi = do
- let darcs = buildDir lbi </> "darcs/darcs"
- manpage = buildDir lbi </> "darcs/darcs.1"
- manpageHandle <- openFile manpage WriteMode
- void $ runProcess darcs ["help","manpage"]
- Nothing Nothing Nothing (Just manpageHandle) Nothing
+buildManpage lbi =
+ when (hasDarcsExe lbi) $ do
+ let darcs = buildDir lbi </> "darcs/darcs"
+ manpage = buildDir lbi </> "darcs/darcs.1"
+ manpageHandle <- openFile manpage WriteMode
+ void $ runProcess darcs ["help","manpage"]
+ Nothing Nothing Nothing (Just manpageHandle) Nothing
-installManpage :: PackageDescription -> LocalBuildInfo
- -> Verbosity -> CopyDest -> IO ()
+installManpage :: PackageDescription -> LocalBuildInfo -> Verbosity -> CopyDest -> IO ()
installManpage pkg lbi verbosity copy =
- copyFiles verbosity
- (mandir (absoluteInstallDirs pkg lbi copy) </> "man1")
- [(buildDir lbi </> "darcs", "darcs.1")]
+ when (hasDarcsExe lbi) $
+ copyFiles
+ verbosity
+ (mandir (absoluteInstallDirs pkg lbi copy) </> "man1")
+ [(buildDir lbi </> "darcs", "darcs.1")]
-- ---------------------------------------------------------------------
-- version module
@@ -187,12 +197,13 @@
generateVersionModule :: Verbosity -> LocalBuildInfo
-> String -> String -> IO ()
generateVersionModule verbosity lbi version state = do
- let dir = autogenModulesDir lbi
+ let dir = autogenPackageModulesDir lbi
createDirectoryIfMissingVerbose verbosity True dir
ctx <- context verbosity
hash <- weakhash verbosity
- rewriteFile (dir </> "Version.hs") $ unlines
+ rewriteFileEx silent (dir </> "Version.hs") $ unlines
["module Version where"
+ ,"import Darcs.Prelude"
,"version, weakhash, context :: String"
,"version = \"" ++ version ++ " (" ++ state ++ ")\""
,"weakhash = " ++ case hash of

View file

@ -0,0 +1,67 @@
From 67bb87ceff53f0178c988dd4e15eeb2daee92b84 Mon Sep 17 00:00:00 2001
From: Gregor Kleen <pngwjpgh@users.noreply.github.com>
Date: Tue, 20 Feb 2018 17:46:24 +0100
Subject: [PATCH] Relax upper version bounds on dependencies
---
Setup.hs | 20 ++++++++++++++++----
encoding.cabal | 4 ++--
stack.yaml | 4 ++--
3 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/Setup.hs b/Setup.hs
index de719e6..fe5b84c 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -1,13 +1,25 @@
+{-# LANGUAGE CPP #-}
+
module Main where
import Distribution.Simple
import Data.Encoding.Preprocessor.Mapping
import Data.Encoding.Preprocessor.XMLMappingBuilder
+#if MIN_VERSION_Cabal(2,0,0)
+main = defaultMainWithHooks (simpleUserHooks
+ {hookedPreProcessors = ( ("mapping" , \_ _ _ -> mappingPreprocessor)
+ : ("mapping2", \_ _ _ -> mappingPreprocessor)
+ : ("xml" , \_ _ _ -> xmlPreprocessor)
+ : (hookedPreProcessors simpleUserHooks)
+ )
+ })
+#else
main = defaultMainWithHooks (simpleUserHooks
- {hookedPreProcessors = (("mapping",\_ _ -> mappingPreprocessor)
- :("mapping2",\_ _ -> mappingPreprocessor)
- :("xml",\_ _ -> xmlPreprocessor)
- :(hookedPreProcessors simpleUserHooks)
+ {hookedPreProcessors = ( ("mapping" , \_ _ -> mappingPreprocessor)
+ : ("mapping2", \_ _ -> mappingPreprocessor)
+ : ("xml" , \_ _ -> xmlPreprocessor)
+ : (hookedPreProcessors simpleUserHooks)
)
})
+#endif
diff --git a/encoding.cabal b/encoding.cabal
index ec20617..f221715 100644
--- a/encoding.cabal
+++ b/encoding.cabal
@@ -36,7 +36,7 @@ Source-Repository this
Custom-Setup
Setup-Depends: base >=3 && <5,
- Cabal >=1.24 && <1.25,
+ Cabal >=1.24 && <2.1,
containers,
filepath,
ghc-prim,
@@ -51,7 +51,7 @@ Library
extensible-exceptions >=0.1 && <0.2,
ghc-prim >=0.3 && <0.6,
mtl >=2.0 && <2.3,
- regex-compat >=0.71 && <0.95
+ regex-compat >=0.71 && <0.96
Extensions: CPP

View file

@ -0,0 +1,383 @@
Only in dbus-1.2.13-new: .codeclimate.yml
diff -ur dbus-1.2.13-old/dbus.cabal dbus-1.2.13-new/dbus.cabal
--- dbus-1.2.13-old/dbus.cabal 2020-04-25 19:29:27.372272952 +0200
+++ dbus-1.2.13-new/dbus.cabal 2020-04-25 19:26:36.140991920 +0200
@@ -1,172 +1,180 @@
-cabal-version: >=1.8
name: dbus
version: 1.2.13
license: Apache-2.0
license-file: license.txt
-maintainer: Andrey Sverdlichenko <blaze@ruddy.ru>
author: John Millikin <john@john-millikin.com>
+maintainer: Andrey Sverdlichenko <blaze@ruddy.ru>
+build-type: Simple
+cabal-version: >= 1.8
+category: Network, Desktop
stability: experimental
homepage: https://github.com/rblaze/haskell-dbus#readme
+
synopsis: A client library for the D-Bus IPC system.
description:
- D-Bus is a simple, message-based protocol for inter-process
- communication, which allows applications to interact with other parts of
- the machine and the user's session using remote procedure calls.
- .
- D-Bus is a essential part of the modern Linux desktop, where it replaces
- earlier protocols such as CORBA and DCOP.
- .
- This library is an implementation of the D-Bus protocol in Haskell. It
- can be used to add D-Bus support to Haskell applications, without the
- awkward interfaces common to foreign bindings.
- .
- Example: connect to the session bus, and get a list of active names.
- .
- @
- &#x7b;-\# LANGUAGE OverloadedStrings \#-&#x7d;
- .
- import Data.List (sort)
- import DBus
- import DBus.Client
- .
- main = do
- &#x20; client <- connectSession
- &#x20; //
- &#x20; \-- Request a list of connected clients from the bus
- &#x20; reply <- call_ client (methodCall \"\/org\/freedesktop\/DBus\" \"org.freedesktop.DBus\" \"ListNames\")
- &#x20; &#x7b; methodCallDestination = Just \"org.freedesktop.DBus\"
- &#x20; &#x7d;
- &#x20; //
- &#x20; \-- org.freedesktop.DBus.ListNames() returns a single value, which is
- &#x20; \-- a list of names (here represented as [String])
- &#x20; let Just names = fromVariant (methodReturnBody reply !! 0)
- &#x20; //
- &#x20; \-- Print each name on a line, sorted so reserved names are below
- &#x20; \-- temporary names.
- &#x20; mapM_ putStrLn (sort names)
- @
- .
- >$ ghc --make list-names.hs
- >$ ./list-names
- >:1.0
- >:1.1
- >:1.10
- >:1.106
- >:1.109
- >:1.110
- >ca.desrt.dconf
- >org.freedesktop.DBus
- >org.freedesktop.Notifications
- >org.freedesktop.secrets
- >org.gnome.ScreenSaver
-category: Network, Desktop
-build-type: Simple
+ D-Bus is a simple, message-based protocol for inter-process
+ communication, which allows applications to interact with other parts of
+ the machine and the user's session using remote procedure calls.
+ .
+ D-Bus is a essential part of the modern Linux desktop, where it replaces
+ earlier protocols such as CORBA and DCOP.
+ .
+ This library is an implementation of the D-Bus protocol in Haskell. It
+ can be used to add D-Bus support to Haskell applications, without the
+ awkward interfaces common to foreign bindings.
+ .
+ Example: connect to the session bus, and get a list of active names.
+ .
+ @
+ &#x7b;-\# LANGUAGE OverloadedStrings \#-&#x7d;
+ .
+ import Data.List (sort)
+ import DBus
+ import DBus.Client
+ .
+ main = do
+ &#x20; client <- connectSession
+ &#x20;
+ &#x20; -- Request a list of connected clients from the bus
+ &#x20; reply <- call_ client (methodCall \"\/org\/freedesktop\/DBus\" \"org.freedesktop.DBus\" \"ListNames\")
+ &#x20; &#x7b; methodCallDestination = Just \"org.freedesktop.DBus\"
+ &#x20; &#x7d;
+ &#x20;
+ &#x20; -- org.freedesktop.DBus.ListNames() returns a single value, which is
+ &#x20; -- a list of names (here represented as [String])
+ &#x20; let Just names = fromVariant (methodReturnBody reply !! 0)
+ &#x20;
+ &#x20; -- Print each name on a line, sorted so reserved names are below
+ &#x20; -- temporary names.
+ &#x20; mapM_ putStrLn (sort names)
+ @
+ .
+ >$ ghc --make list-names.hs
+ >$ ./list-names
+ >:1.0
+ >:1.1
+ >:1.10
+ >:1.106
+ >:1.109
+ >:1.110
+ >ca.desrt.dconf
+ >org.freedesktop.DBus
+ >org.freedesktop.Notifications
+ >org.freedesktop.secrets
+ >org.gnome.ScreenSaver
+
+
extra-source-files:
- examples/dbus-monitor.hs
- examples/export.hs
- examples/introspect.hs
- examples/list-names.hs
- idlxml/dbus.xml
+ examples/dbus-monitor.hs
+ examples/export.hs
+ examples/introspect.hs
+ examples/list-names.hs
+ idlxml/dbus.xml
source-repository head
- type: git
- location: https://github.com/rblaze/haskell-dbus
+ type: git
+ location: https://github.com/rblaze/haskell-dbus
library
- exposed-modules:
- DBus
- DBus.Client
- DBus.Generation
- DBus.Internal.Address
- DBus.Internal.Message
- DBus.Internal.Types
- DBus.Internal.Wire
- DBus.Introspection
- DBus.Introspection.Parse
- DBus.Introspection.Render
- DBus.Introspection.Types
- DBus.Socket
- DBus.TH
- DBus.Transport
- hs-source-dirs: lib
- ghc-options: -W -Wall
- build-depends:
- base ==4.*,
- bytestring <0.11,
- cereal <0.6,
- conduit >=1.3.0 && <1.4,
- containers <0.7,
- deepseq <1.5,
- exceptions <0.11,
- filepath <1.5,
- lens <4.20,
- network >=3.0.1.0 && <3.2,
- parsec <3.2,
- random <1.2,
- split <0.3,
- template-haskell <2.16.0.0,
- text <1.3,
- th-lift <0.9,
- transformers <0.6,
- unix <2.8,
- vector <0.13,
- xml-conduit >=1.9.0.0 && <1.10.0.0,
- xml-types <0.4
+ ghc-options: -W -Wall
+ hs-source-dirs: lib
+
+ build-depends:
+ base >=4 && <5
+ , bytestring
+ , cereal
+ , conduit >= 1.3.0
+ , containers
+ , deepseq
+ , exceptions
+ , filepath
+ , lens < 4.20
+ , network >= 3.0.1.0 && < 3.2
+ , parsec
+ , random
+ , split
+ , template-haskell < 2.17.0.0
+ , text
+ , th-lift < 0.9
+ , transformers
+ , unix
+ , vector
+ , xml-conduit >= 1.9.0.0 && < 1.10.0.0
+ , xml-types
+
+ exposed-modules:
+ DBus
+ DBus.Client
+ DBus.Generation
+ DBus.Internal.Address
+ DBus.Internal.Message
+ DBus.Internal.Types
+ DBus.Internal.Wire
+ DBus.Introspection
+ DBus.Introspection.Parse
+ DBus.Introspection.Render
+ DBus.Introspection.Types
+ DBus.Socket
+ DBus.TH
+ DBus.Transport
test-suite dbus_tests
- type: exitcode-stdio-1.0
- main-is: DBusTests.hs
- hs-source-dirs: tests
- other-modules:
- DBusTests.Address
- DBusTests.BusName
- DBusTests.Client
- DBusTests.ErrorName
- DBusTests.Generation
- DBusTests.Integration
- DBusTests.InterfaceName
- DBusTests.Introspection
- DBusTests.MemberName
- DBusTests.Message
- DBusTests.ObjectPath
- DBusTests.Serialization
- DBusTests.Signature
- DBusTests.Socket
- DBusTests.TH
- DBusTests.Transport
- DBusTests.Util
- DBusTests.Variant
- DBusTests.Wire
- ghc-options: -W -Wall -fno-warn-orphans
- build-depends:
- dbus -any,
- base ==4.*,
- bytestring <0.11,
- cereal <0.6,
- containers <0.7,
- directory <1.4,
- extra <1.8,
- filepath <1.5,
- network >=3.0.1.0 && <3.2,
- parsec <3.2,
- process <1.7,
- QuickCheck <2.15,
- random <1.2,
- resourcet <1.3,
- tasty <1.3,
- tasty-hunit <0.11,
- tasty-quickcheck <0.11,
- text <1.3,
- transformers <0.6,
- unix <2.8,
- vector <0.13
+ type: exitcode-stdio-1.0
+ main-is: DBusTests.hs
+ hs-source-dirs: tests
+ ghc-options: -W -Wall -fno-warn-orphans
+
+ build-depends:
+ dbus
+ , base >=4 && <5
+ , bytestring
+ , cereal
+ , containers
+ , directory
+ , extra < 1.8
+ , filepath
+ , network >= 3.0.1.0 && < 3.2
+ , parsec
+ , process
+ , QuickCheck < 2.15
+ , random
+ , resourcet
+ , tasty
+ , tasty-hunit
+ , tasty-quickcheck
+ , text
+ , transformers
+ , unix
+ , vector
+
+ other-modules:
+ DBusTests.Address
+ DBusTests.BusName
+ DBusTests.Client
+ DBusTests.ErrorName
+ DBusTests.Generation
+ DBusTests.Integration
+ DBusTests.InterfaceName
+ DBusTests.Introspection
+ DBusTests.MemberName
+ DBusTests.Message
+ DBusTests.ObjectPath
+ DBusTests.Serialization
+ DBusTests.Signature
+ DBusTests.Socket
+ DBusTests.TH
+ DBusTests.Transport
+ DBusTests.Util
+ DBusTests.Variant
+ DBusTests.Wire
benchmark dbus_benchmarks
- type: exitcode-stdio-1.0
- main-is: DBusBenchmarks.hs
- hs-source-dirs: benchmarks
- ghc-options: -Wall -fno-warn-orphans
- build-depends:
- dbus -any,
- base ==4.*,
- criterion <1.6
+ type: exitcode-stdio-1.0
+ main-is: DBusBenchmarks.hs
+ hs-source-dirs: benchmarks
+ ghc-options: -Wall -fno-warn-orphans
+
+ build-depends:
+ dbus
+ , base >=4 && <5
+ , criterion
Only in dbus-1.2.13-new: .git
Only in dbus-1.2.13-new: .gitignore
diff -ur dbus-1.2.13-old/lib/DBus/Generation.hs dbus-1.2.13-new/lib/DBus/Generation.hs
--- dbus-1.2.13-old/lib/DBus/Generation.hs 2019-02-14 16:37:47.000000000 +0100
+++ dbus-1.2.13-new/lib/DBus/Generation.hs 2020-04-25 19:26:36.144991997 +0200
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
module DBus.Generation where
@@ -26,6 +27,13 @@
import Prelude hiding (mapM)
import System.Posix.Types (Fd(..))
+-- | Compatibility helper to create (total) tuple expressions
+mkTupE :: [Exp] -> Exp
+mkTupE = TupE
+#if MIN_VERSION_template_haskell(2,16,0)
+ . map Just
+#endif
+
type ClientBusPathR a = ReaderT (Client, T.BusName, T.ObjectPath) IO a
dbusInvoke :: (Client -> T.BusName -> T.ObjectPath -> a) -> ClientBusPathR a
@@ -232,8 +240,8 @@
finalOutputNames <- buildOutputNames
let variantListExp = map makeToVariantApp methodArgNames
mapOrHead' = mapOrHead outputLength
- fromVariantExp = mapOrHead' makeFromVariantApp fromVariantOutputNames TupE
- finalResultTuple = mapOrHead' VarE finalOutputNames TupE
+ fromVariantExp = mapOrHead' makeFromVariantApp fromVariantOutputNames mkTupE
+ finalResultTuple = mapOrHead' VarE finalOutputNames mkTupE
maybeExtractionPattern = mapOrHead' makeJustPattern finalOutputNames TupP
getMethodCallDefDec = [d|
$( varP methodCallDefN ) =
@@ -432,7 +440,7 @@
}
|]
let mapOrHead' = mapOrHead argCount
- fromVariantExp = mapOrHead' makeFromVariantApp fromVariantOutputNames TupE
+ fromVariantExp = mapOrHead' makeFromVariantApp fromVariantOutputNames mkTupE
maybeExtractionPattern = mapOrHead' makeJustPattern toHandlerOutputNames TupP
applyToName toApply n = AppE toApply $ VarE n
finalApplication = foldl applyToName (VarE handlerArgN)

View file

@ -0,0 +1,65 @@
diff --git a/GHC/Paths.hs b/GHC/Paths.hs
index c87565d..88b3db4 100644
--- a/GHC/Paths.hs
+++ b/GHC/Paths.hs
@@ -1,13 +1,35 @@
{-# LANGUAGE CPP #-}
+{-# LANGUAGE ScopedTypeVariables #-}
module GHC.Paths (
ghc, ghc_pkg, libdir, docdir
) where
+import Control.Exception as E
+import Data.Maybe
+import System.Environment
+import System.IO.Unsafe
+
+-- Yes, there's lookupEnv now, but we want to be compatible
+-- with older GHCs.
+checkEnv :: String -> IO (Maybe String)
+checkEnv var = E.catch (fmap Just (getEnv var))
+ (\ (e :: IOException) -> return Nothing)
+
+nixLibdir, nixDocdir, nixGhc, nixGhcPkg :: Maybe FilePath
+nixLibdir = unsafePerformIO (checkEnv "NIX_GHCJS_LIBDIR")
+nixDocdir = unsafePerformIO (checkEnv "NIX_GHCJS_DOCDIR")
+nixGhc = unsafePerformIO (checkEnv "NIX_GHCJS")
+nixGhcPkg = unsafePerformIO (checkEnv "NIX_GHCJSPKG")
+{-# NOINLINE nixLibdir #-}
+{-# NOINLINE nixDocdir #-}
+{-# NOINLINE nixGhc #-}
+{-# NOINLINE nixGhcPkg #-}
+
libdir, docdir, ghc, ghc_pkg :: FilePath
-libdir = GHC_PATHS_LIBDIR
-docdir = GHC_PATHS_DOCDIR
+libdir = fromMaybe GHC_PATHS_LIBDIR nixLibdir
+docdir = fromMaybe GHC_PATHS_DOCDIR nixDocdir
-ghc = GHC_PATHS_GHC
-ghc_pkg = GHC_PATHS_GHC_PKG
+ghc = fromMaybe GHC_PATHS_GHC nixGhc
+ghc_pkg = fromMaybe GHC_PATHS_GHC_PKG nixGhcPkg
diff --git a/Setup.hs b/Setup.hs
index f2d1733..ca4792e 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -39,13 +39,13 @@ main = defaultMainWithHooks simpleUserHooks {
#else
libdir_ <- rawSystemProgramStdoutConf (fromFlag (configVerbosity flags))
#endif
- ghcProgram (withPrograms lbi) ["--print-libdir"]
+ ghcjsProgram (withPrograms lbi) ["--print-libdir"]
let libdir = reverse $ dropWhile isSpace $ reverse libdir_
- ghc_pkg = case lookupProgram ghcPkgProgram (withPrograms lbi) of
+ ghc_pkg = case lookupProgram ghcjsPkgProgram (withPrograms lbi) of
Just p -> programPath p
Nothing -> error "ghc-pkg was not found"
- ghc = case lookupProgram ghcProgram (withPrograms lbi) of
+ ghc = case lookupProgram ghcjsProgram (withPrograms lbi) of
Just p -> programPath p
Nothing -> error "ghc was not found"

View file

@ -0,0 +1,43 @@
diff -Naur ghc-paths-0.1.0.9/GHC/Paths.hs ghc-paths-0.1.0.9-new/GHC/Paths.hs
--- ghc-paths-0.1.0.9/GHC/Paths.hs 2012-12-16 13:53:45.720148396 +0100
+++ ghc-paths-0.1.0.9-new/GHC/Paths.hs 2012-12-16 17:22:12.765576568 +0100
@@ -1,13 +1,35 @@
{-# LANGUAGE CPP #-}
+{-# LANGUAGE ScopedTypeVariables #-}
module GHC.Paths (
ghc, ghc_pkg, libdir, docdir
) where
+import Control.Exception as E
+import Data.Maybe
+import System.Environment
+import System.IO.Unsafe
+
+-- Yes, there's lookupEnv now, but we want to be compatible
+-- with older GHCs.
+checkEnv :: String -> IO (Maybe String)
+checkEnv var = E.catch (fmap Just (getEnv var))
+ (\ (e :: IOException) -> return Nothing)
+
+nixLibdir, nixDocdir, nixGhc, nixGhcPkg :: Maybe FilePath
+nixLibdir = unsafePerformIO (checkEnv "NIX_GHC_LIBDIR")
+nixDocdir = unsafePerformIO (checkEnv "NIX_GHC_DOCDIR")
+nixGhc = unsafePerformIO (checkEnv "NIX_GHC")
+nixGhcPkg = unsafePerformIO (checkEnv "NIX_GHCPKG")
+{-# NOINLINE nixLibdir #-}
+{-# NOINLINE nixDocdir #-}
+{-# NOINLINE nixGhc #-}
+{-# NOINLINE nixGhcPkg #-}
+
libdir, docdir, ghc, ghc_pkg :: FilePath
-libdir = GHC_PATHS_LIBDIR
-docdir = GHC_PATHS_DOCDIR
+libdir = fromMaybe GHC_PATHS_LIBDIR nixLibdir
+docdir = fromMaybe GHC_PATHS_DOCDIR nixDocdir
-ghc = GHC_PATHS_GHC
-ghc_pkg = GHC_PATHS_GHC_PKG
+ghc = fromMaybe GHC_PATHS_GHC nixGhc
+ghc_pkg = fromMaybe GHC_PATHS_GHC_PKG nixGhcPkg

View file

@ -0,0 +1,26 @@
diff --git a/gogol-core.cabal b/gogol-core.cabal
index 4c47988..caa4796 100644
--- a/gogol-core.cabal
+++ b/gogol-core.cabal
@@ -62,7 +62,7 @@ library
, lens >= 4.4
, resourcet >= 1.1
, scientific >= 0.3
- , servant >= 0.4.4
+ , servant >= 0.14.1
, text >= 1.1
, unordered-containers >= 0.2.5
diff --git a/src/Network/Google/Prelude.hs b/src/Network/Google/Prelude.hs
index a4ad9de..795c690 100644
--- a/src/Network/Google/Prelude.hs
+++ b/src/Network/Google/Prelude.hs
@@ -28,7 +28,7 @@ import Network.HTTP.Client as Export (RequestBody)
import Numeric.Natural as Export (Natural)
import Prelude as Export hiding (product, span, any, Word)
import Servant.API as Export hiding (Headers, Link, getResponse, Stream, ResponseHeader, Header, header)
-import Servant.Utils.Links as Export hiding (Link)
+import Servant.Links as Export hiding (Link)
import Web.HttpApiData as Export (FromHttpApiData (..), ToHttpApiData (..))
import Network.Google.Data.Bytes as Export

View file

@ -0,0 +1,40 @@
diff --git a/Data/GraphViz/Commands.hs b/Data/GraphViz/Commands.hs
index 20e7dbe..514c29d 100644
--- a/Data/GraphViz/Commands.hs
+++ b/Data/GraphViz/Commands.hs
@@ -63,14 +63,14 @@ import System.IO (Handle, hPutStrLn, hSetBinaryMode, stderr)
-- -----------------------------------------------------------------------------
showCmd :: GraphvizCommand -> String
-showCmd Dot = "dot"
-showCmd Neato = "neato"
-showCmd TwoPi = "twopi"
-showCmd Circo = "circo"
-showCmd Fdp = "fdp"
-showCmd Sfdp = "sfdp"
-showCmd Osage = "osage"
-showCmd Patchwork = "patchwork"
+showCmd Dot = "@graphviz@/bin/dot"
+showCmd Neato = "@graphviz@/bin/neato"
+showCmd TwoPi = "@graphviz@/bin/twopi"
+showCmd Circo = "@graphviz@/bin/circo"
+showCmd Fdp = "@graphviz@/bin/fdp"
+showCmd Sfdp = "@graphviz@/bin/sfdp"
+showCmd Osage = "@graphviz@/bin/osage"
+showCmd Patchwork = "@graphviz@/bin/patchwork"
-- | The default command for directed graphs.
dirCommand :: GraphvizCommand
@@ -312,8 +312,11 @@ runGraphvizCanvas' d = runGraphvizCanvas (commandFor d) d
-- | Is the Graphviz suite of tools installed? This is determined by
-- whether @dot@ is available in the @PATH@.
+--
+-- Note: With nixpkgs, this will always return 'True' as graphviz'
+-- store paths are hardcoded instead of looking at @PATH@.
isGraphvizInstalled :: IO Bool
-isGraphvizInstalled = liftM isJust . findExecutable $ showCmd Dot
+isGraphvizInstalled = pure True -- :)
-- | If Graphviz does not seem to be available, print the provided
-- error message and then exit fatally.

View file

@ -0,0 +1,30 @@
diff -Naur hunspell-hs-0.1.0.0.orig/hunspell-hs.cabal hunspell-hs-0.1.0.0/hunspell-hs.cabal
--- hunspell-hs-0.1.0.0.orig/hunspell-hs.cabal 2018-08-26 20:23:33.053763300 +0200
+++ hunspell-hs-0.1.0.0/hunspell-hs.cabal 2018-08-26 20:42:05.886074510 +0200
@@ -37,7 +37,7 @@
base >=4.7 && <5
, stm
if os(linux)
- extra-libraries:
+ pkgconfig-depends:
hunspell
if os(darwin)
include-dirs:
@@ -63,7 +63,7 @@
, hunspell-hs
, stm
if os(linux)
- extra-libraries:
+ pkgconfig-depends:
hunspell
if os(darwin)
include-dirs:
@@ -88,7 +88,7 @@
, hunspell-hs
, stm
if os(linux)
- extra-libraries:
+ pkgconfig-depends:
hunspell
if os(darwin)
include-dirs:

View file

@ -0,0 +1,95 @@
diff --git a/lambdabot-core.cabal b/lambdabot-core.cabal
index 861a28b..87175a3 100644
--- a/lambdabot-core.cabal
+++ b/lambdabot-core.cabal
@@ -19,7 +19,7 @@ homepage: https://wiki.haskell.org/Lambdabot
build-type: Simple
cabal-version: >= 1.10
-tested-with: GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.4, GHC == 8.10.4
+tested-with: GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.4, GHC == 8.10.4, GHC == 9.0.2
extra-source-files: AUTHORS.md
COMMENTARY.md
@@ -89,9 +89,8 @@ library
network-bsd >= 2.7 && < 2.9,
parsec >= 3,
prim-uniq >= 0.2 && < 0.4,
- random >= 1,
- random-fu >= 0.2.6.2,
- random-source >= 0.3,
+ random >= 1.2,
+ random-fu >= 0.3.0.0,
regex-tdfa >= 1.1 && < 1.4,
SafeSemaphore >= 0.9,
split >= 0.2,
diff --git a/src/Lambdabot/Bot.hs b/src/Lambdabot/Bot.hs
index 1b0de2e..833fb4c 100644
--- a/src/Lambdabot/Bot.hs
+++ b/src/Lambdabot/Bot.hs
@@ -1,6 +1,5 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ScopedTypeVariables #-}
-{-# LANGUAGE TemplateHaskell #-}
-- | The guts of lambdabot.
--
-- The LB/Lambdabot monad
@@ -37,7 +36,6 @@ import Control.Monad.Error
import Control.Monad.Reader
import Control.Monad.State
import qualified Data.Map as M
-import Data.Random.Source
import qualified Data.Set as S
------------------------------------------------------------------------
@@ -136,17 +134,3 @@ ircPrivmsg who msg = do
ircPrivmsg' :: Nick -> String -> LB ()
ircPrivmsg' who "" = ircPrivmsg' who " "
ircPrivmsg' who msg = send $ privmsg who msg
-
-------------------------------------------------------------------------
-
-monadRandom [d|
-
- instance MonadRandom LB where
- getRandomWord8 = liftIO getRandomWord8
- getRandomWord16 = liftIO getRandomWord16
- getRandomWord32 = liftIO getRandomWord32
- getRandomWord64 = liftIO getRandomWord64
- getRandomDouble = liftIO getRandomDouble
- getRandomNByteInteger n = liftIO (getRandomNByteInteger n)
-
- |]
diff --git a/src/Lambdabot/Util.hs b/src/Lambdabot/Util.hs
index effdf71..259699b 100644
--- a/src/Lambdabot/Util.hs
+++ b/src/Lambdabot/Util.hs
@@ -23,14 +23,15 @@ module Lambdabot.Util (
randomSuccessMsg
) where
+import Control.Concurrent.Lifted
import Control.Monad.Trans
+import Control.Monad.Trans.Control
import Data.Char
import Data.List
import Data.Random
-import Control.Concurrent.Lifted
-import Control.Monad.Trans.Control
import Lambdabot.Config
import Lambdabot.Config.Core
+import System.Random.Stateful (newIOGenM, newStdGen)
------------------------------------------------------------------------
@@ -63,7 +64,9 @@ listToStr conj (item:items) =
-- | Pick a random element of the list.
random :: MonadIO m => [a] -> m a
-random = io . sample . randomElement
+random l = do
+ g <- newIOGenM =<< newStdGen
+ sampleFrom g (randomElement l)
------------------------------------------------------------------------

View file

@ -0,0 +1,58 @@
diff --git a/lambdabot-novelty-plugins.cabal b/lambdabot-novelty-plugins.cabal
index 69c8447..50a35f6 100644
--- a/lambdabot-novelty-plugins.cabal
+++ b/lambdabot-novelty-plugins.cabal
@@ -36,7 +36,7 @@ homepage: https://wiki.haskell.org/Lambdabot
build-type: Simple
cabal-version: >= 1.10
-tested-with: GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.4, GHC == 8.10.4
+tested-with: GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.4, GHC == 8.10.4, GHC == 9.0.2
source-repository head
type: git
@@ -71,7 +71,8 @@ library
lambdabot-core >= 5.3 && < 5.4,
misfortune >= 0.1,
process >= 1.1,
- random-fu >= 0.2.6.2,
+ random >= 1.2,
+ random-fu >= 0.3.0.0,
regex-tdfa >= 1.1,
-- runtime dependencies
diff --git a/src/Lambdabot/Plugin/Novelty/Numberwang.hs b/src/Lambdabot/Plugin/Novelty/Numberwang.hs
index ae41eb4..8321a14 100644
--- a/src/Lambdabot/Plugin/Novelty/Numberwang.hs
+++ b/src/Lambdabot/Plugin/Novelty/Numberwang.hs
@@ -7,7 +7,9 @@ import Control.Monad
import Data.Random
import Data.Random.Distribution.Poisson
import Lambdabot.Plugin
+import Lambdabot.Util
import Numeric
+import System.Random.Stateful (newIOGenM, newStdGen)
data NumberwangState = State
@@ -23,7 +25,9 @@ conDist = poisson (32 :: Double)
numberwangPlugin :: Module NumberwangState
numberwangPlugin = newModule
- { moduleDefState = sample (State <$> cmdDist <*> conDist)
+ { moduleDefState = do
+ g <- newIOGenM =<< newStdGen
+ sampleFrom g (State <$> cmdDist <*> conDist)
, moduleCmds = return
[ (command "numberwang")
{ help = say "@numberwang <number>: Determines if it is Numberwang."
@@ -61,7 +65,8 @@ checkNumberwang :: (MonadLBState m, LBState m ~ NumberwangState) =>
checkNumberwang cmd l = withState cmd $ \ n setN nDist -> do
if n <= l
then do
- setN =<< lb (sample nDist)
+ g <- newIOGenM =<< newStdGen
+ setN =<< sampleFrom g nDist
return True
else do
setN (n - l)

View file

@ -0,0 +1,70 @@
diff --git a/misfortune.cabal b/misfortune.cabal
index f5d0dd3..faa5794 100644
--- a/misfortune.cabal
+++ b/misfortune.cabal
@@ -113,7 +113,8 @@ Library
directory,
filepath,
knob,
- random-fu >= 0.2.2,
+ random,
+ random-fu >= 0.3,
semigroups,
text,
utf8-string,
diff --git a/src/Data/Fortune.hs b/src/Data/Fortune.hs
index 16d221e..ffbc970 100644
--- a/src/Data/Fortune.hs
+++ b/src/Data/Fortune.hs
@@ -64,6 +64,7 @@ import Paths_misfortune
import System.Directory
import System.Environment
import System.FilePath
+import System.Random.Stateful (newIOGenM, newStdGen)
-- |The number of fortune strings in the index
numFortunes :: S.FortuneStats -> Int
@@ -233,9 +234,10 @@ randomFortune paths = withFortuneFiles '%' False paths $ \fs -> do
-- random fortune from that file (unformly).
randomFortuneFromRandomFile :: RVar FortuneFile -> IO String
randomFortuneFromRandomFile file = do
- f <- sample file
+ gen <- newStdGen >>= newIOGenM
+ f <- sampleFrom gen file
n <- getNumFortunes f
- i <- sample (uniform 0 (n-1))
+ i <- sampleFrom gen (uniform 0 (n-1))
T.unpack <$> getFortune f i
-- |Given a list of 'FortuneFile's, compute a distrubution over them weighted by the number
diff --git a/src/Fortune.hs b/src/Fortune.hs
index 5a27578..d6ffb74 100644
--- a/src/Fortune.hs
+++ b/src/Fortune.hs
@@ -21,6 +21,7 @@ import System.Environment
import System.Exit
import System.FilePath
import System.IO
+import System.Random.Stateful (newIOGenM, newStdGen)
import Text.Printf
import Text.Regex.Base
import Text.Regex.PCRE
@@ -200,6 +201,7 @@ main = do
fortunes <- filterM (filterFile args) (fortuneFiles args)
dist <- getDist args fortunes
+ gen <- newStdGen >>= newIOGenM
when (numEvents dist == 0) $ do
hPutStrLn stderr "No fortunes matched the filter criteria"
@@ -225,8 +227,8 @@ main = do
, let pctStr = printf "(%.2f%%)" (100 * weight / totalWeight dist) :: String
]
else do
- (file, fortuneDist) <- sample dist
- fortune <- sample fortuneDist
+ (file, fortuneDist) <- sampleFrom gen dist
+ fortune <- sampleFrom gen fortuneDist
putStrLn . T.unpack =<< getFortune file fortune
getDist :: Args -> [FortuneFile] -> IO (Categorical Float (FortuneFile, Categorical Float Int))

View file

@ -0,0 +1,11 @@
diff -ur opencv-0.0.2.1.bak/Setup.hs opencv-0.0.2.1/Setup.hs
--- opencv-0.0.2.1.bak/Setup.hs 2018-11-10 17:18:41.355731189 +0100
+++ opencv-0.0.2.1/Setup.hs 2018-11-10 17:18:56.901681162 +0100
@@ -3,6 +3,6 @@
main = do
args <- getArgs
- let args' | "configure" `elem` args = args ++ ["--with-gcc","c++", "--with-ld","c++"]
+ let args' | "configure" `elem` args = args ++ ["--with-gcc","c++"]
| otherwise = args
defaultMainArgs args'

View file

@ -0,0 +1,8 @@
--- a/Setup.hs 2021-02-04 14:01:09.557970245 +0100
+++ b/Setup.hs 2021-02-04 14:07:45.047443753 +0100
@@ -3,4 +3,4 @@
import Distribution.Simple
main :: IO ()
-main = defaultMainWithHooks defaultUserHooks
+main = defaultMainWithHooks autoconfUserHooks

View file

@ -0,0 +1,24 @@
diff --git a/recursion-schemes.cabal b/recursion-schemes.cabal
index c35f2c6..e692ade 100644
--- a/recursion-schemes.cabal
+++ b/recursion-schemes.cabal
@@ -93,6 +93,7 @@ library
Paths_recursion_schemes
ghc-options: -Wall
+ ghc-prof-options: -DPROFILING_ENABLED
if impl(ghc >= 8.6)
ghc-options: -Wno-star-is-type
default-language: Haskell2010
diff --git a/src/Data/Functor/Foldable/TH.hs b/src/Data/Functor/Foldable/TH.hs
index b3d5ac8..d4ef0e4 100644
--- a/src/Data/Functor/Foldable/TH.hs
+++ b/src/Data/Functor/Foldable/TH.hs
@@ -1,4 +1,7 @@
{-# LANGUAGE CPP, PatternGuards, Rank2Types #-}
+#if defined(PROFILING_ENABLED)
+{-# OPTIONS_GHC -O0 #-}
+#endif
module Data.Functor.Foldable.TH
( MakeBaseFunctor(..)
, BaseRules

View file

@ -0,0 +1,19 @@
diff -rN -u old-regex-compat-tdfa/Text/Regex.hs new-regex-compat-tdfa/Text/Regex.hs
--- old-regex-compat-tdfa/Text/Regex.hs 2022-02-20 13:42:36.828752458 +0100
+++ new-regex-compat-tdfa/Text/Regex.hs 2022-02-20 13:42:36.828752458 +0100
@@ -139,7 +139,7 @@
splitRegex :: Regex -> String -> [String]
splitRegex _ [] = []
splitRegex delim strIn =
- let matches = map (!0) (matchAll delim strIn)
+ let matches = map (! 0) (matchAll delim strIn)
go _i str [] = str : []
go i str ((off,len):rest) =
let i' = off+len
@@ -194,4 +194,4 @@
then [firstline,""]
else firstline : loop remainder
--}
\ No newline at end of file
+-}

View file

@ -0,0 +1,75 @@
diff --git a/servant-client-core.cabal b/servant-client-core.cabal
index 5789da601..3faf65bb4 100644
--- a/servant-client-core.cabal
+++ b/servant-client-core.cabal
@@ -96,6 +96,7 @@ test-suite spec
main-is: Spec.hs
other-modules:
Servant.Client.Core.Internal.BaseUrlSpec
+ Servant.Client.Core.RequestSpec
-- Dependencies inherited from the library. No need to specify bounds.
build-depends:
diff --git a/src/Servant/Client/Core/Request.hs b/src/Servant/Client/Core/Request.hs
index 73756e702..0276d46f8 100644
--- a/src/Servant/Client/Core/Request.hs
+++ b/src/Servant/Client/Core/Request.hs
@@ -64,8 +64,32 @@ data RequestF body path = Request
, requestHeaders :: Seq.Seq Header
, requestHttpVersion :: HttpVersion
, requestMethod :: Method
- } deriving (Generic, Typeable, Eq, Show, Functor, Foldable, Traversable)
+ } deriving (Generic, Typeable, Eq, Functor, Foldable, Traversable)
+instance (Show a, Show b) =>
+ Show (Servant.Client.Core.Request.RequestF a b) where
+ showsPrec p req
+ = showParen
+ (p >= 11)
+ ( showString "Request {requestPath = "
+ . showsPrec 0 (requestPath req)
+ . showString ", requestQueryString = "
+ . showsPrec 0 (requestQueryString req)
+ . showString ", requestBody = "
+ . showsPrec 0 (requestBody req)
+ . showString ", requestAccept = "
+ . showsPrec 0 (requestAccept req)
+ . showString ", requestHeaders = "
+ . showsPrec 0 (redactSensitiveHeader <$> requestHeaders req))
+ . showString ", requestHttpVersion = "
+ . showsPrec 0 (requestHttpVersion req)
+ . showString ", requestMethod = "
+ . showsPrec 0 (requestMethod req)
+ . showString "}"
+ where
+ redactSensitiveHeader :: Header -> Header
+ redactSensitiveHeader ("Authorization", _) = ("Authorization", "<REDACTED>")
+ redactSensitiveHeader h = h
instance Bifunctor RequestF where bimap = bimapDefault
instance Bifoldable RequestF where bifoldMap = bifoldMapDefault
instance Bitraversable RequestF where
diff --git a/test/Servant/Client/Core/RequestSpec.hs b/test/Servant/Client/Core/RequestSpec.hs
new file mode 100644
index 000000000..99a1db7d3
--- /dev/null
+++ b/test/Servant/Client/Core/RequestSpec.hs
@@ -0,0 +1,19 @@
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-# LANGUAGE OverloadedStrings #-}
+module Servant.Client.Core.RequestSpec (spec) where
+
+
+import Prelude ()
+import Prelude.Compat
+import Control.Monad
+import Data.List (isInfixOf)
+import Servant.Client.Core.Request
+import Test.Hspec
+
+spec :: Spec
+spec = do
+ describe "Request" $ do
+ describe "show" $ do
+ it "redacts the authorization header" $ do
+ let request = void $ defaultRequest { requestHeaders = pure ("authorization", "secret") }
+ isInfixOf "secret" (show request) `shouldBe` False

View file

@ -0,0 +1,86 @@
diff -Naurw sexpr-0.2.1/Codec/Sexpr/Internal.hs sexpr-0.2.1-patched/Codec/Sexpr/Internal.hs
--- sexpr-0.2.1/Codec/Sexpr/Internal.hs 2009-04-30 00:51:06.000000000 +0200
+++ sexpr-0.2.1-patched/Codec/Sexpr/Internal.hs 2018-08-03 01:38:08.000000000 +0200
@@ -62,11 +62,6 @@
return $ List []]
arbSexpr n = oneof [Atom <$> arbitrary,
List <$> (resize (n `div` 2) arbitrary)]
- coarbitrary (Atom s) = variant 0 . coarbitrary s
- coarbitrary (HintedAtom h s) = variant 1 . coarbitrary_h . coarbitrary s
- where coarbitrary_h =
- foldr (\a b -> variant (ord a) . variant 1 . b) (variant 0) h
- coarbitrary (List ss) = variant 2 . coarbitrary ss
-- |@fold f s@ applies f to each sub-S-expression of s, from each leaf
-- to the root. @f@ need not preserve the shape of @s@, in contrast
diff -Naurw sexpr-0.2.1/Codec/Sexpr/Printer.hs sexpr-0.2.1-patched/Codec/Sexpr/Printer.hs
--- sexpr-0.2.1/Codec/Sexpr/Printer.hs 2009-04-30 00:51:06.000000000 +0200
+++ sexpr-0.2.1-patched/Codec/Sexpr/Printer.hs 2018-08-03 01:41:56.000000000 +0200
@@ -1,4 +1,4 @@
-{-# LANGUAGE FlexibleInstances, OverlappingInstances #-}
+{-# LANGUAGE FlexibleInstances #-}
-- | Export S-expressions in any of the three ordinary forms:
--
@@ -17,6 +17,8 @@
module Codec.Sexpr.Printer where
+import Prelude hiding ((<>))
+
import Codec.Sexpr.Internal
import Data.Binary.Put
@@ -30,7 +32,7 @@
instance Show (Sexpr String) where
show s = advancedString s
-instance Show s => Show (Sexpr s) where
+instance {-# OVERLAPPABLE #-} Show s => Show (Sexpr s) where
show s = advancedString $ fmap show s
raw :: String -> String -> String
diff -Naurw sexpr-0.2.1/Codec/Sexpr/Tests.hs sexpr-0.2.1-patched/Codec/Sexpr/Tests.hs
--- sexpr-0.2.1/Codec/Sexpr/Tests.hs 2009-04-30 00:51:06.000000000 +0200
+++ sexpr-0.2.1-patched/Codec/Sexpr/Tests.hs 2018-08-03 01:46:32.000000000 +0200
@@ -67,11 +67,9 @@
instance Arbitrary B.ByteString where
arbitrary = B.pack `fmap` arbitrary
- coarbitrary = undefined
instance Arbitrary Char where
arbitrary = choose (32,255) >>= \n -> return (chr n)
- coarbitrary n = variant (ord n)
main :: IO ()
diff -Naurw sexpr-0.2.1/sexpr.cabal sexpr-0.2.1-patched/sexpr.cabal
--- sexpr-0.2.1/sexpr.cabal 2018-08-03 01:36:11.000000000 +0200
+++ sexpr-0.2.1-patched/sexpr.cabal 2018-08-03 01:49:13.000000000 +0200
@@ -13,23 +13,9 @@
maintainer: bts@evenmere.org
build-type: Simple
-flag testing
- description: build test executable
- default: False
-
library
- if flag(testing)
- ghc-options: -Wall
- Build-Depends: base, base64-string, pretty, bytestring, binary
+ Build-Depends: base, base64-string, pretty, bytestring, binary, QuickCheck
Exposed-modules: Codec.Sexpr
-
-executable sexpr-test
- if !flag(testing)
- buildable: False
- ghc-options: -Wall
- main-is: Codec/Sexpr/Tests.hs
- other-modules: Codec.Sexpr
- Codec.Sexpr.Parser
+ other-modules: Codec.Sexpr.Parser
Codec.Sexpr.Printer
Codec.Sexpr.Internal
- build-depends: QuickCheck, random

View file

@ -0,0 +1,16 @@
diff --git a/System/Xattr.hsc b/System/Xattr.hsc
index adaf9cb..9b49996 100644
--- a/System/Xattr.hsc
+++ b/System/Xattr.hsc
@@ -45,11 +45,7 @@ module System.Xattr
where
#include <sys/types.h>
-#ifdef __APPLE__
#include <sys/xattr.h>
-#else
-#include <attr/xattr.h>
-#endif
import Data.Functor ((<$>))
import Foreign.C

View file

@ -0,0 +1,34 @@
diff --git a/src/XMonad/Core.hs b/src/XMonad/Core.hs
index 46a0939..92af53d 100644
--- a/src/XMonad/Core.hs
+++ b/src/XMonad/Core.hs
@@ -46,6 +46,7 @@ import Data.Traversable (for)
import Data.Time.Clock (UTCTime)
import Data.Default.Class
import Data.List (isInfixOf)
+import System.Environment (lookupEnv)
import System.FilePath
import System.IO
import System.Info
@@ -458,7 +459,8 @@ xfork x = io . forkProcess . finally nullStdin $ do
-- | Use @xmessage@ to show information to the user.
xmessage :: MonadIO m => String -> m ()
xmessage msg = void . xfork $ do
- executeFile "xmessage" True
+ xmessageBin <- fromMaybe "xmessage" <$> liftIO (lookupEnv "XMONAD_XMESSAGE")
+ executeFile xmessageBin True
[ "-default", "okay"
, "-xrm", "*international:true"
, "-xrm", "*fontSet:-*-fixed-medium-r-normal-*-18-*-*-*-*-*-*-*,-*-fixed-*-*-*-*-18-*-*-*-*-*-*-*,-*-*-*-*-*-*-18-*-*-*-*-*-*-*"
@@ -654,8 +656,9 @@ compile dirs method =
bracket (openFile (errFileName dirs) WriteMode) hClose $ \err -> do
let run = runProc (cfgDir dirs) err
case method of
- CompileGhc ->
- run "ghc" ghcArgs
+ CompileGhc -> do
+ ghc <- fromMaybe "ghc" <$> (lookupEnv "NIX_GHC")
+ run ghc ghcArgs
CompileStackGhc stackYaml ->
run "stack" ["build", "--silent", "--stack-yaml", stackYaml] .&&.
run "stack" ("ghc" : "--stack-yaml" : stackYaml : "--" : ghcArgs)

View file

@ -0,0 +1,11 @@
addStackArgs () {
if [ -n "$(echo $1/lib/lib*)" ]; then
STACK_IN_NIX_EXTRA_ARGS+=" --extra-lib-dirs=$1/lib"
fi
if [ -d "$1/include" ]; then
STACK_IN_NIX_EXTRA_ARGS+=" --extra-include-dirs=$1/include"
fi
}
addEnvHooks "$targetOffset" addStackArgs

View file

@ -0,0 +1,183 @@
{ lib, stdenv, haskellPackages, symlinkJoin, makeWrapper
# GHC will have LLVM available if necessary for the respective target,
# so useLLVM only needs to be changed if -fllvm is to be used for a
# platform that has NCG support
, useLLVM ? false
, withHoogle ? false
, hoogleWithPackages
, postBuild ? ""
, ghcLibdir ? null # only used by ghcjs, when resolving plugins
}:
# This argument is a function which selects a list of Haskell packages from any
# passed Haskell package set.
#
# Example:
# (hpkgs: [ hpkgs.mtl hpkgs.lens ])
selectPackages:
# It's probably a good idea to include the library "ghc-paths" in the
# compiler environment, because we have a specially patched version of
# that package in Nix that honors these environment variables
#
# NIX_GHC
# NIX_GHCPKG
# NIX_GHC_DOCDIR
# NIX_GHC_LIBDIR
#
# instead of hard-coding the paths. The wrapper sets these variables
# appropriately to configure ghc-paths to point back to the wrapper
# instead of to the pristine GHC package, which doesn't know any of the
# additional libraries.
#
# A good way to import the environment set by the wrapper below into
# your shell is to add the following snippet to your ~/.bashrc:
#
# if [ -e ~/.nix-profile/bin/ghc ]; then
# eval $(grep export ~/.nix-profile/bin/ghc)
# fi
let
inherit (haskellPackages) llvmPackages ghc;
packages = selectPackages haskellPackages
++ lib.optional withHoogle (hoogleWithPackages selectPackages);
isGhcjs = ghc.isGhcjs or false;
isHaLVM = ghc.isHaLVM or false;
ghc761OrLater = isGhcjs || isHaLVM || lib.versionOlder "7.6.1" ghc.version;
packageDBFlag = if ghc761OrLater then "--global-package-db" else "--global-conf";
ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
ghcCommand = "${ghc.targetPrefix}${ghcCommand'}";
ghcCommandCaps= lib.toUpper ghcCommand';
libDir = if isHaLVM then "$out/lib/HaLVM-${ghc.version}"
else "$out/lib/${ghc.targetPrefix}${ghc.haskellCompilerName}";
docDir = "$out/share/doc/ghc/html";
packageCfgDir = "${libDir}/package.conf.d";
paths = lib.filter (x: x ? isHaskellLibrary) (lib.closePropagation packages);
hasLibraries = lib.any (x: x.isHaskellLibrary) paths;
# CLang is needed on Darwin for -fllvm to work:
# https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
llvm = lib.makeBinPath
([ llvmPackages.llvm ]
++ lib.optional stdenv.targetPlatform.isDarwin llvmPackages.clang);
in
assert ghcLibdir != null -> (ghc.isGhcjs or false);
if paths == [] && !useLLVM then ghc else
symlinkJoin {
# this makes computing paths from the name attribute impossible;
# if such a feature is needed, the real compiler name should be saved
# as a dedicated drv attribute, like `compiler-name`
name = ghc.name + "-with-packages";
paths = paths ++ [ghc];
nativeBuildInputs = [ makeWrapper ];
postBuild = ''
# wrap compiler executables with correct env variables
for prg in ${ghcCommand} ${ghcCommand}i ${ghcCommand}-${ghc.version} ${ghcCommand}i-${ghc.version}; do
if [[ -x "${ghc}/bin/$prg" ]]; then
rm -f $out/bin/$prg
makeWrapper ${ghc}/bin/$prg $out/bin/$prg \
--add-flags '"-B$NIX_${ghcCommandCaps}_LIBDIR"' \
--set "NIX_${ghcCommandCaps}" "$out/bin/${ghcCommand}" \
--set "NIX_${ghcCommandCaps}PKG" "$out/bin/${ghcCommand}-pkg" \
--set "NIX_${ghcCommandCaps}_DOCDIR" "${docDir}" \
--set "NIX_${ghcCommandCaps}_LIBDIR" "${libDir}" \
${lib.optionalString (ghc.isGhcjs or false)
''--set NODE_PATH "${ghc.socket-io}/lib/node_modules"''
} \
${lib.optionalString useLLVM ''--prefix "PATH" ":" "${llvm}"''}
fi
done
for prg in runghc runhaskell; do
if [[ -x "${ghc}/bin/$prg" ]]; then
rm -f $out/bin/$prg
makeWrapper ${ghc}/bin/$prg $out/bin/$prg \
--add-flags "-f $out/bin/${ghcCommand}" \
--set "NIX_${ghcCommandCaps}" "$out/bin/${ghcCommand}" \
--set "NIX_${ghcCommandCaps}PKG" "$out/bin/${ghcCommand}-pkg" \
--set "NIX_${ghcCommandCaps}_DOCDIR" "${docDir}" \
--set "NIX_${ghcCommandCaps}_LIBDIR" "${libDir}"
fi
done
for prg in ${ghcCommand}-pkg ${ghcCommand}-pkg-${ghc.version}; do
if [[ -x "${ghc}/bin/$prg" ]]; then
rm -f $out/bin/$prg
makeWrapper ${ghc}/bin/$prg $out/bin/$prg --add-flags "${packageDBFlag}=${packageCfgDir}"
fi
done
# haddock was referring to the base ghc, https://github.com/NixOS/nixpkgs/issues/36976
if [[ -x "${ghc}/bin/haddock" ]]; then
rm -f $out/bin/haddock
makeWrapper ${ghc}/bin/haddock $out/bin/haddock \
--add-flags '"-B$NIX_${ghcCommandCaps}_LIBDIR"' \
--set "NIX_${ghcCommandCaps}_LIBDIR" "${libDir}"
fi
'' + (lib.optionalString (stdenv.targetPlatform.isDarwin && !isGhcjs && !stdenv.targetPlatform.isiOS) ''
# Work around a linker limit in macOS Sierra (see generic-builder.nix):
local packageConfDir="${packageCfgDir}";
local dynamicLinksDir="$out/lib/links"
mkdir -p $dynamicLinksDir
# Clean up the old links that may have been (transitively) included by
# symlinkJoin:
rm -f $dynamicLinksDir/*
for d in $(grep -Poz "dynamic-library-dirs:\s*\K .+\n" $packageConfDir/*|awk '{print $2}'|sort -u); do
ln -s $d/*.dylib $dynamicLinksDir
done
for f in $packageConfDir/*.conf; do
# Initially, $f is a symlink to a read-only file in one of the inputs
# (as a result of this symlinkJoin derivation).
# Replace it with a copy whose dynamic-library-dirs points to
# $dynamicLinksDir
cp $f $f-tmp
rm $f
sed "N;s,dynamic-library-dirs:\s*.*,dynamic-library-dirs: $dynamicLinksDir," $f-tmp > $f
rm $f-tmp
done
'') + ''
${lib.optionalString hasLibraries ''
# GHC 8.10 changes.
# Instead of replacing package.cache[.lock] with the new file,
# ghc-pkg is now trying to open the file. These file are symlink
# to another nix derivation, so they are not writable. Removing
# them allow the correct behavior of ghc-pkg recache
# See: https://github.com/NixOS/nixpkgs/issues/79441
rm ${packageCfgDir}/package.cache.lock
rm ${packageCfgDir}/package.cache
$out/bin/${ghcCommand}-pkg recache
''}
${# ghcjs will read the ghc_libdir file when resolving plugins.
lib.optionalString (isGhcjs && ghcLibdir != null) ''
mkdir -p "${libDir}"
rm -f "${libDir}/ghc_libdir"
printf '%s' '${ghcLibdir}' > "${libDir}/ghc_libdir"
''}
$out/bin/${ghcCommand}-pkg check
'' + postBuild;
passthru = {
preferLocalBuild = true;
inherit (ghc) version meta;
# Inform users about backwards incompatibilities with <= 21.05
override = _: throw ''
The ghc.withPackages wrapper itself can now be overridden, but no longer
the result of calling it (as before). Consequently overrides need to be
adjusted: Instead of
(ghc.withPackages (p: [ p.my-package ])).override { withLLLVM = true; }
use
(ghc.withPackages.override { useLLVM = true; }) (p: [ p.my-package ])
Also note that withLLVM has been renamed to useLLVM for consistency with
the GHC Nix expressions.'';
};
}