Skip to content

Commit f17697b

Browse files
authored
Use readDirectory to simplify bumping dependencies (#501)
This comes in handy when testing Stackage-related bumps to upper bounds
1 parent ee308a6 commit f17697b

File tree

3 files changed

+56
-11
lines changed

3 files changed

+56
-11
lines changed

default.nix

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,27 @@ let
99
outputSha256 = "0ga345hgw6v2kzyhvf5kw96hf60mx5pbd9c4qj5q4nan4lr7nkxn";
1010
};
1111

12+
readDirectory = import ./nix/readDirectory.nix;
13+
1214
config = {
1315
packageOverrides = pkgs: {
1416
haskellPackages = pkgs.haskellPackages.override {
15-
overrides = haskellPackagesNew: haskellPackagesOld: {
16-
dhall =
17-
pkgs.haskell.lib.failOnAllWarnings
18-
(pkgs.haskell.lib.justStaticExecutables
19-
(haskellPackagesNew.callPackage ./nix/dhall.nix { })
20-
);
21-
22-
formatting = haskellPackagesOld.formatting_6_3_0;
23-
24-
prettyprinter = haskellPackagesOld.prettyprinter_1_2_0_1;
25-
};
17+
overrides =
18+
let
19+
manualOverrides =
20+
haskellPackagesNew: haskellPackagesOld: {
21+
dhall =
22+
pkgs.haskell.lib.failOnAllWarnings
23+
(pkgs.haskell.lib.justStaticExecutables
24+
haskellPackagesOld.dhall
25+
);
26+
27+
prettyprinter =
28+
pkgs.haskell.lib.dontCheck haskellPackagesOld.prettyprinter;
29+
};
30+
31+
in
32+
pkgs.lib.composeExtensions (readDirectory ./nix) manualOverrides;
2633
};
2734
};
2835
};

nix/prettyprinter.nix

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{ mkDerivation, ansi-wl-pprint, base, bytestring, containers
2+
, criterion, deepseq, doctest, mtl, pgp-wordlist, QuickCheck
3+
, random, stdenv, tasty, tasty-hunit, tasty-quickcheck, text
4+
, transformers
5+
}:
6+
mkDerivation {
7+
pname = "prettyprinter";
8+
version = "1.2.1";
9+
sha256 = "e7653e0ba87cc06553a50e4780dde81c5dd156196c0199511d03d972e5517fcf";
10+
isLibrary = true;
11+
isExecutable = true;
12+
libraryHaskellDepends = [ base text ];
13+
testHaskellDepends = [
14+
base bytestring doctest pgp-wordlist tasty tasty-hunit
15+
tasty-quickcheck text
16+
];
17+
benchmarkHaskellDepends = [
18+
ansi-wl-pprint base containers criterion deepseq mtl QuickCheck
19+
random text transformers
20+
];
21+
homepage = "http://github.com/quchen/prettyprinter";
22+
description = "A modern, easy to use, well-documented, extensible pretty-printer";
23+
license = stdenv.lib.licenses.bsd2;
24+
}

nix/readDirectory.nix

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
directory:
2+
3+
haskellPackagesNew: haskellPackagesOld:
4+
let
5+
haskellPaths = builtins.attrNames (builtins.readDir directory);
6+
7+
toKeyVal = file: {
8+
name = builtins.replaceStrings [ ".nix" ] [ "" ] file;
9+
10+
value = haskellPackagesNew.callPackage (directory + "/${file}") { };
11+
};
12+
13+
in
14+
builtins.listToAttrs (map toKeyVal haskellPaths)

0 commit comments

Comments
 (0)