Skip to content

Commit faa773e

Browse files
committed
Merge branch 'master' of https://github.com/input-output-hk/haskell.nix into circuithub
2 parents 71e52c0 + 85898ec commit faa773e

File tree

12 files changed

+104
-26
lines changed

12 files changed

+104
-26
lines changed

build.nix

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,15 @@ in rec {
5656
inherit evalPackages;
5757
};
5858
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.6" < 0) {
59-
hls-latest = tool compiler-nix-name "haskell-language-server" {
59+
"hls-110" = tool compiler-nix-name "haskell-language-server" {
6060
inherit evalPackages;
6161
src = pkgs.haskell-nix.sources."hls-1.10";
6262
};
63+
} // {
64+
"hls-20" = tool compiler-nix-name "haskell-language-server" {
65+
inherit evalPackages;
66+
src = pkgs.haskell-nix.sources."hls-2.0";
67+
};
6368
})
6469
);
6570

builder/comp-builder.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ let
362362
});
363363
profiled = self (drvArgs // { enableLibraryProfiling = true; });
364364
dwarf = self (drvArgs // { enableDWARF = true; });
365-
} // lib.optionalAttrs (haskellLib.isLibrary componentId) ({
365+
} // lib.optionalAttrs (haskellLib.isLibrary componentId || haskellLib.isTest componentId) ({
366366
inherit haddock;
367367
inherit (haddock) haddockDir; # This is null if `doHaddock = false`
368368
} // lib.optionalAttrs (haddock ? doc) {

builder/haddock-builder.nix

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323

2424
let
2525
doHaddock' = doHaddock
26-
&& (haskellLib.isLibrary componentId)
26+
&& (haskellLib.isLibrary componentId || haskellLib.isTest componentId)
2727
&& !haskellLib.isCrossHost;
2828

29-
# the target dir for haddock documentation
30-
docdir = docoutput: docoutput + "/share/doc/" + componentId.cname;
29+
# The target dir for haddock documentation
30+
docdir = docoutput: docoutput + "/share/doc/" + package.identifier.name;
3131

3232
packageCfgDir = configFiles.packageCfgDir;
3333

@@ -111,6 +111,7 @@ let
111111
[[ -n $(find . -name "*.hs" -o -name "*.lhs") ]] && {
112112
$SETUP_HS haddock \
113113
"--html" \
114+
${lib.optionalString (haskellLib.isTest componentId) "--tests"} \
114115
${lib.optionalString doHoogle "--hoogle"} \
115116
${lib.optionalString hyperlinkSource "--hyperlink-source"} \
116117
${lib.optionalString quickjump "--quickjump"} \
@@ -129,7 +130,7 @@ let
129130
# Ensure that libraries are not pulled into the docs closure.
130131
# As an example, the prettified source code of a
131132
# Paths_package module will contain store paths of the library package.
132-
for x in "$html/src/"*.html; do
133+
for x in $(find "$html" -name "*.html"); do
133134
remove-references-to -t $out $x
134135
remove-references-to -t ${componentDrv} $x
135136
done

flake.lock

Lines changed: 24 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
flake-compat = { url = "github:input-output-hk/flake-compat/hkm/gitlab-fix"; flake = false; };
1414
flake-utils = { url = "github:hamishmack/flake-utils/hkm/nested-hydraJobs"; };
1515
"hls-1.10" = { url = "github:haskell/haskell-language-server/1.10.0.0"; flake = false; };
16+
"hls-2.0" = { url = "github:haskell/haskell-language-server/2.0.0.0"; flake = false; };
1617
hydra.url = "hydra";
1718
hackage = {
1819
url = "github:input-output-hk/hackage.nix";

lib/call-cabal-project-to-nix.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,9 @@ let
496496
--exclude '*' \
497497
$tmp/ $out/
498498
499+
# Make sure the subDir' exists even if it did not contain any cabal files
500+
mkdir -p $out${subDir'}
501+
499502
# make sure the path's in the plan.json are relative to $out instead of $tmp
500503
# this is necessary so that plan-to-nix relative path logic can work.
501504
substituteInPlace $tmp${subDir'}/dist-newstyle/cache/plan.json --replace "$tmp" "$out"

lib/system-nixpkgs-map.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ in
5252
bz2 = [ bzip2 ];
5353
util = [ utillinux ];
5454
magic = [ file ];
55+
pgcommon = [ postgresql ];
56+
pgport = [ postgresql] ;
5557
pq = [ postgresql ];
5658
libpq = [ postgresql ];
5759
iconv = [ libiconv ];

modules/configuration-nix.nix

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,31 @@ in {
8383

8484
# See https://github.com/input-output-hk/haskell.nix/issues/1455
8585
# This is a work around to make `ghcide` and `haskell-language-server` build with the unboxed tuple patch.
86-
packages.ghcide.patches =
87-
# Work out if we have applied the unboxed tupple patch in overlays/bootstrap.nix
88-
pkgs.lib.optionals (__elem config.compiler.nix-name [
89-
"ghc8101" "ghc8102" "ghc8103" "ghc8104" "ghc8105" "ghc8106" "ghc8107" "ghc810420210212"
90-
]) [
91-
(fromUntil "1.7.0.0" "1.8.0.0" ../patches/ghcide-1.7-unboxed-tuple-fix-issue-1455.patch)
92-
(fromUntil "1.8.0.0" "1.11.0.0" ../patches/ghcide-1.8-unboxed-tuple-fix-issue-1455.patch)
93-
]
94-
# This is needed for a patch only applied to ghc810420210212
95-
++ pkgs.lib.optional (__elem config.compiler.nix-name [
96-
"ghc810420210212"
97-
]) (from "1.7.0.0" ../patches/ghcide-1.7-plutus-ghc.patch);
86+
packages.ghcide = pkgs.lib.mkIf (__elem config.compiler.nix-name [
87+
# Work out if we have applied the unboxed tupple patch in overlays/bootstrap.nix
88+
"ghc8101" "ghc8102" "ghc8103" "ghc8104" "ghc8105" "ghc8106" "ghc8107" "ghc810420210212"
89+
]) {
90+
patches =
91+
[
92+
(fromUntil "1.7.0.0" "1.8.0.0" ../patches/ghcide-1.7-unboxed-tuple-fix-issue-1455.patch)
93+
(fromUntil "1.8.0.0" "2.1.0.0" ../patches/ghcide-1.8-unboxed-tuple-fix-issue-1455.patch)
94+
]
95+
# This is needed for a patch only applied to ghc810420210212
96+
++ pkgs.lib.optional (__elem config.compiler.nix-name [
97+
"ghc810420210212"
98+
]) (from "1.7.0.0" ../patches/ghcide-1.7-plutus-ghc.patch);
99+
flags = {
100+
# This flag has enables an additional work around that normally
101+
# is only enabled for ghc >=9.2.
102+
ghc-patched-unboxed-bytecode = true;
103+
};
104+
};
105+
106+
# Fix for https://github.com/input-output-hk/haskell.nix/issues/1961
107+
packages.haskell-language-server.components.exes.haskell-language-server = {
108+
keepGhc = pkgs.stdenv.hostPlatform.isDarwin;
109+
keepConfigFiles = pkgs.stdenv.hostPlatform.isDarwin;
110+
};
98111

99112
packages.language-c.patches = [
100113
# See https://github.com/visq/language-c/pull/89

modules/package.nix

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,15 @@ in {
301301
type = either path package;
302302
default = pkgs.fetchurl { url = "mirror://hackage/${config.name}.tar.gz"; inherit (config) sha256; };
303303
defaultText = "pkgs.fetchurl { url = \"mirror://hackage/\${config.name}.tar.gz\"; inherit (config) sha256; };";
304+
# Make sure paths have a context so they will be included in the derivation
305+
# inputs for the component derivations. Without this sandbox builds fail
306+
# cannot see the input and fail with the error:
307+
# do not know how to unpack source archive /nix/store/...
308+
apply = v:
309+
let storeDirMatch = __match "(${__storeDir}/[^/]+).*" v;
310+
in if isString v && __getContext v == {} && storeDirMatch != null
311+
then __appendContext v { ${__head storeDirMatch} = { path = true; }; }
312+
else v;
304313
};
305314
package-description-override = mkOption {
306315
type = nullOr str;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{ lib, cabalProject', tool, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages }:
2+
let
3+
project = cabalProject' {
4+
name = "cabal-project-nix-path";
5+
inherit compiler-nix-name evalPackages;
6+
src = testSrc "cabal-project-nix-path";
7+
cabalProject = ''
8+
packages: ${(tool compiler-nix-name "hello" { inherit evalPackages; }).project.args.src}
9+
'';
10+
};
11+
# The same but with source in a subdir of the store path
12+
projectSubDir = project.appendModule {
13+
cabalProject = lib.mkForce ''
14+
packages: ${evalPackages.runCommand "hello-src" {} "mkdir -p $out && cp -r ${(tool compiler-nix-name "hello" { inherit evalPackages; }).project.args.src} $out/subdir"}/subdir
15+
'';
16+
};
17+
18+
in recurseIntoAttrs {
19+
ifdInputs = {
20+
inherit (project) plan-nix;
21+
};
22+
23+
build = project.hsPkgs.hello.components.exes.hello;
24+
buildSubDir = projectSubDir.hsPkgs.hello.components.exes.hello;
25+
}

0 commit comments

Comments
 (0)