Skip to content

Commit 47aeb87

Browse files
committed
overlay.nix: pass compiler instead of haskell.lib, add couple of fixes
1 parent 8ccc703 commit 47aeb87

File tree

2 files changed

+42
-9
lines changed

2 files changed

+42
-9
lines changed

default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
, compiler ? null
33
}:
44
let
5-
overlay = import ./overlay.nix pkgs pkgs.haskell.lib;
5+
overlay = import ./overlay.nix pkgs compiler;
66
overrideHaskellPackages = orig: {
77
buildHaskellPackages =
88
orig.buildHaskellPackages.override overrideHaskellPackages;

overlay.nix

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,69 @@
1-
pkgs: hlib: helf: huper:
1+
pkgs: compiler: hself: hsuper:
22
let
33
lib = pkgs.lib;
4+
haskellLib = pkgs.haskell.lib;
5+
6+
fetchGitHubPR = { url, sha256 ? throw "sha256 required", ...}@x:
7+
let
8+
m = builtins.match "https://github.com/(.+)/(.+)/pull/([0-9]+)" url;
9+
parts = if m != null then m else throw "Failed to match PR URL";
10+
in
11+
pkgs.fetchFromGitHub ({
12+
owner = builtins.elemAt parts 0;
13+
repo = builtins.elemAt parts 1;
14+
rev = "refs/pull/${builtins.elemAt parts 2}/head";
15+
} // (lib.filterAttrs (n: v: n != "url") x));
416
in
517
{
618
# srk 2023-11-18: this is pinned in nixpkgs unstable to 1.0.5
719
# causing trouble with ghc963
8-
some = helf.callHackageDirect
20+
some = hself.callHackageDirect
921
{ pkg = "some";
1022
ver = "1.0.6";
1123
sha256 = "sha256-AnjaUzSlsLi3lIURrEfs92Jo5FzX49RyNdfDSfFV3Kk=";
1224
} {};
1325

26+
# srk 2023-11-19: default in unstable is 0.1.1.1 which
27+
# fails to compile test on ghc8107
28+
# but for for ghc963 we hit
29+
# https://github.com/obsidiansystems/dependent-sum-template/issues/10
30+
# so we use 0.1.1.1 for ghc963 and 0.2.0.0 for the rest
31+
# - some weird interaction in unstable as this builds
32+
# with cabal and 0.2.0.0
33+
dependent-sum-template =
34+
if compiler == "ghc963"
35+
then hsuper.dependent-sum-template
36+
else hsuper.dependent-sum-template_0_2_0_0;
37+
38+
# srk 2023-11-19: wider unix bound via CPP
39+
# Required for ghc963 since linux-namespaces is pinned
40+
# in unstable to 0.1.3.0
41+
linux-namespaces = hself.callCabal2nix "linux-namespaces"
42+
(fetchGitHubPR {
43+
url = "https://github.com/redneb/hs-linux-namespaces/pull/4";
44+
sha256 = "sha256-R61OCu6b4YoDzIl0vg8cSoP7611TlEdWZfVDnZrJY+g=";
45+
}) {};
46+
1447
hnix-store-core =
1548
lib.pipe
16-
(helf.callCabal2nix "hnix-store-core" ./hnix-store-core {})
49+
(hself.callCabal2nix "hnix-store-core" ./hnix-store-core {})
1750
[
18-
hlib.compose.buildFromSdist
51+
haskellLib.compose.buildFromSdist
1952
];
2053
hnix-store-remote =
2154
lib.pipe
2255
# enable -fio-testsuite for Linux systems as
2356
# it requires linux-namespaces
24-
# NOTE: we cannot use hlib.compose.enableCabalFlag
57+
# NOTE: we cannot use haskellLib.compose.enableCabalFlag
2558
# as the testsuite deps won't get picked up
2659
# after cabal2nix step
2760
(
2861
if pkgs.stdenv.isDarwin
29-
then helf.callCabal2nix "hnix-store-remote" ./hnix-store-remote {}
30-
else helf.callCabal2nixWithOptions "hnix-store-remote" ./hnix-store-remote "-fio-testsuite" {}
62+
then hself.callCabal2nix "hnix-store-remote" ./hnix-store-remote {}
63+
else hself.callCabal2nixWithOptions "hnix-store-remote" ./hnix-store-remote "-fio-testsuite" {}
3164
)
3265
[
33-
hlib.compose.buildFromSdist
66+
haskellLib.compose.buildFromSdist
3467
(pkg: pkg.overrideAttrs (attrs: {
3568
buildInputs = attrs.buildInputs ++ [
3669
pkgs.nix

0 commit comments

Comments
 (0)