Skip to content

Commit fbbfee2

Browse files
Merge #800 default.nix: post-release upd and clean-up
2 parents 3e0417c + 7a9c88e commit fbbfee2

File tree

1 file changed

+38
-103
lines changed

1 file changed

+38
-103
lines changed

default.nix

Lines changed: 38 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,15 @@
111111

112112
let
113113

114+
hlib = pkgs.haskell.lib;
115+
lib = pkgs.lib;
116+
114117
getDefaultGHC = "ghc${
115118
(
116119
# Remove '.' from the string 8.8.4 -> 884
117-
pkgs.lib.stringAsChars (c: if c == "." then "" else c)
120+
lib.stringAsChars (c: if c == "." then "" else c)
118121
# Get default GHC version,
119-
(pkgs.lib.getVersion pkgs.haskellPackages.ghc)
122+
(lib.getVersion pkgs.haskellPackages.ghc)
120123
)
121124
}";
122125

@@ -125,18 +128,18 @@ let
125128
then getDefaultGHC
126129
else compiler;
127130

128-
# 2020-12-31: NOTE: Remove after `hnix-store 0.4` arrives into Nixpkgs
129-
hnix-store-src = pkgs.fetchFromGitHub {
130-
owner = "haskell-nix";
131-
repo = "hnix-store";
132-
rev = "fd09d29b8bef4904058f033d693e7d928a4a92dc";
133-
sha256 = "0fxig1ckzknm5g19jzg7rrcpz7ssn4iiv9bs9hff9gfy3ciq4zrs";
134-
};
131+
# Overlay source
132+
# hnix-store-src = pkgs.fetchFromGitHub {
133+
# owner = "haskell-nix";
134+
# repo = "hnix-store";
135+
# rev = "fd09d29b8bef4904058f033d693e7d928a4a92dc";
136+
# sha256 = "0fxig1ckzknm5g19jzg7rrcpz7ssn4iiv9bs9hff9gfy3ciq4zrs";
137+
# };
135138

136-
overlay = pkgs.lib.foldr pkgs.lib.composeExtensions (_: _: {}) [
137-
(import "${hnix-store-src}/overlay.nix" pkgs pkgs.haskell.lib)
139+
overlay = lib.foldr lib.composeExtensions (_: _: {}) [
140+
# (import "${hnix-store-src}/overlay.nix" pkgs hlib)
138141
(self: super:
139-
pkgs.lib.optionalAttrs withHoogle {
142+
lib.optionalAttrs withHoogle {
140143
ghc = super.ghc // { withPackages = super.ghc.withHoogle; };
141144
ghcWithPackages = self.ghc.withPackages;
142145
})
@@ -146,7 +149,7 @@ let
146149
buildHaskellPackages =
147150
orig.buildHaskellPackages.override overrideHaskellPackages;
148151
overrides = if orig ? overrides
149-
then pkgs.lib.composeExtensions orig.overrides overlay
152+
then lib.composeExtensions orig.overrides overlay
150153
else overlay;
151154
};
152155

@@ -156,58 +159,19 @@ let
156159
# Application of functions from this list to the package in code here happens in the reverse order (from the tail). Some options depend on & override others, so if enabling options caused Nix error or not expected result - change the order, and please do not change this order without proper testing.
157160
listSwitchFunc =
158161
[
159-
{
160-
switch = sdistTarball;
161-
function = pkgs.haskell.lib.sdistTarball;
162-
}
163-
{
164-
switch = buildFromSdist;
165-
function = pkgs.haskell.lib.buildFromSdist;
166-
}
167-
{
168-
switch = buildStrictly;
169-
function = pkgs.haskell.lib.buildStrictly;
170-
}
171-
{
172-
switch = disableOptimization;
173-
function = pkgs.haskell.lib.disableOptimization;
174-
}
175-
{
176-
switch = doJailbreak;
177-
function = pkgs.haskell.lib.doJailBreak;
178-
}
179-
{
180-
switch = doStrip;
181-
function = pkgs.haskell.lib.doStrip;
182-
}
183-
{
184-
switch = enableDWARFDebugging;
185-
function = pkgs.haskell.lib.enableDWARFDebugging;
186-
}
187-
{
188-
switch = linkWithGold;
189-
function = pkgs.haskell.lib.linkWithGold;
190-
}
191-
{
192-
switch = failOnAllWarnings;
193-
function = pkgs.haskell.lib.failOnAllWarnings;
194-
}
195-
{
196-
switch = justStaticExecutables;
197-
function = pkgs.haskell.lib.justStaticExecutables;
198-
}
199-
{
200-
switch = checkUnusedPackages;
201-
function = pkgs.haskell.lib.checkUnusedPackages {};
202-
}
203-
{
204-
switch = generateOptparseApplicativeCompletions;
205-
function = pkgs.haskell.lib.generateOptparseApplicativeCompletions executableNamesToShellComplete;
206-
}
207-
{
208-
switch = doHyperlinkSource;
209-
function = pkgs.haskell.lib.doHyperlinkSource;
210-
}
162+
{ switch = sdistTarball; function = hlib.sdistTarball; }
163+
{ switch = buildFromSdist; function = hlib.buildFromSdist; }
164+
{ switch = buildStrictly; function = hlib.buildStrictly; }
165+
{ switch = disableOptimization; function = hlib.disableOptimization; }
166+
{ switch = doJailbreak; function = hlib.doJailBreak; }
167+
{ switch = doStrip; function = hlib.doStrip; }
168+
{ switch = enableDWARFDebugging; function = hlib.enableDWARFDebugging; }
169+
{ switch = linkWithGold; function = hlib.linkWithGold; }
170+
{ switch = failOnAllWarnings; function = hlib.failOnAllWarnings; }
171+
{ switch = justStaticExecutables; function = hlib.justStaticExecutables; }
172+
{ switch = checkUnusedPackages; function = hlib.checkUnusedPackages {}; }
173+
{ switch = generateOptparseApplicativeCompletions; function = hlib.generateOptparseApplicativeCompletions executableNamesToShellComplete; }
174+
{ switch = doHyperlinkSource; function = hlib.doHyperlinkSource; }
211175
];
212176

213177
# Function that applies enabled option to the package, used in the fold.
@@ -223,48 +187,19 @@ let
223187
root = packageRoot;
224188

225189
overrides = self: super: {
226-
# 2020-12-07 We really want cryptohash-sha512, but it conflicts with
227-
# recent versions of base, for seemingly no valid reason.
228-
# As the update is slow to happen, just jailbreak here
229-
# See https://github.com/haskell-hvr/cryptohash-sha512 PRs 3, 5 and issue 4
230-
# See also https://github.com/NixOS/nixpkgs/pull/106333 for a temporary fix.
231-
cryptohash-sha512 = pkgs.haskell.lib.unmarkBroken ( pkgs.haskell.lib.doJailbreak super.cryptohash-sha512 );
232190

191+
# 2021-01-06: NOTE:
192+
# Core is on Stackage and pinned at `0.2`: https://github.com/haskell-nix/hnix-store/issues/104
193+
# Stackage report: https://github.com/commercialhaskell/stackage/issues/5766
194+
hnix-store-core = super.hnix-store-core_0_4_0_0;
233195
# 2020-12-07 hnix-store-remote fails when trying to connect to a real hnix daemon.
234196
# probably due to nix sandbox restrictions.
235197
# Upstream issue @ https://github.com/haskell-nix/hnix-store/issues/80
236-
hnix-store-remote = pkgs.haskell.lib.removeConfigureFlag super.hnix-store-remote "-fio-testsuite";
237-
238-
# 2020-08-04 hnix uses custom LayoutOptions and therefore is
239-
# likely to be affected by the change in the ribbon width
240-
# calculation in prettyprinter-1.7.0.
241-
prettyprinter = haskellPackages.callPackage
242-
({ mkDerivation, ansi-wl-pprint, base, base-compat, bytestring
243-
, containers, deepseq, doctest, gauge, mtl, pgp-wordlist
244-
, QuickCheck, quickcheck-instances, random, tasty, tasty-hunit
245-
, tasty-quickcheck, text, transformers, stdenv
246-
}:
247-
mkDerivation {
248-
pname = "prettyprinter";
249-
version = "1.7.0";
250-
sha256 = "19z04sn0kqxgwcyfn5igjmbxw13xsb3mdhdidkb3kzswib78f6sr";
251-
isLibrary = true;
252-
isExecutable = true;
253-
libraryHaskellDepends = [ base text ];
254-
testHaskellDepends = [
255-
base bytestring doctest pgp-wordlist QuickCheck
256-
quickcheck-instances tasty tasty-hunit tasty-quickcheck text
257-
];
258-
benchmarkHaskellDepends = [
259-
ansi-wl-pprint base base-compat containers deepseq gauge mtl
260-
QuickCheck random text transformers
261-
];
262-
description = "A modern, easy to use, well-documented, extensible pretty-printer";
263-
license = stdenv.lib.licenses.bsd2;
264-
}) {};
198+
hnix-store-remote = hlib.unmarkBroken super.hnix-store-remote;
199+
265200
};
266201

267-
modifier = drv: pkgs.haskell.lib.overrideCabal drv (attrs: {
202+
modifier = drv: hlib.overrideCabal drv (attrs: {
268203
buildTools = (attrs.buildTools or []) ++ [
269204
haskellPackages.cabal-install
270205
];
@@ -288,7 +223,7 @@ let
288223
inherit doCoverage;
289224
inherit doHaddock;
290225

291-
configureFlags = pkgs.stdenv.lib.optional doTracing "--flags=tracing";
226+
configureFlags = lib.optional doTracing "--flags=tracing";
292227

293228
passthru = {
294229
nixpkgs = pkgs;
@@ -302,7 +237,7 @@ let
302237
# One part of Haskell.lib options are argument switches, those are in `inherit`ed list.
303238
# Other part - are function wrappers over pkg. Fold allows to compose those.
304239
# composePackage = foldr (if switch then function) (package) ([{switch,function}]) == (functionN .. (function1 package))
305-
composedPackage = pkgs.lib.foldr (onSwitchApplyFunc) package listSwitchFunc;
240+
composedPackage = lib.foldr (onSwitchApplyFunc) package listSwitchFunc;
306241

307242
in composedPackage
308243

0 commit comments

Comments
 (0)