Skip to content

Commit da71b82

Browse files
committed
Merge remote-tracking branch 'origin/master' into support-cabal-doctest
2 parents 69ba0c1 + 62bb4df commit da71b82

File tree

23 files changed

+3624
-41
lines changed

23 files changed

+3624
-41
lines changed

docs/tutorials/getting-started.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,19 @@ trusted-public-keys = [...] hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNG
2121
substituters = [...] https://hydra.iohk.io [...]
2222
```
2323

24-
This can be tricky to get setup properly. If you're still having trouble getting cache hits, consult the corresponding [troubleshooting section](../reference/troubleshooting#why-am-i-building-ghc).
24+
If you're running NixOS, you need to add/update the following in your `/etc/nixos/configuration.nix` files instead.
25+
26+
```
27+
# Binary Cache for Haskell.nix
28+
nix.binaryCachePublicKeys = [
29+
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
30+
];
31+
nix.binaryCaches = [
32+
"https://hydra.iohk.io"
33+
];
34+
```
35+
36+
This can be tricky to get setup properly. If you're still having trouble getting cache hits, consult the corresponding [troubleshooting section](../../troubleshooting#why-am-i-building-ghc).
2537

2638
## Scaffolding
2739

hackage-src.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"url": "https://github.com/input-output-hk/hackage.nix",
3-
"rev": "f10ac1731430fcbb403dfc311b81558d6f2918a9",
4-
"date": "2021-01-14T01:14:09+00:00",
5-
"path": "/nix/store/d56pfsmi4fn0jy2274pnhpwmmm1xc5p2-hackage.nix-f10ac17",
6-
"sha256": "18n3zl9069h7vhm7jmd6nhg99d7dd4qzkvcqvkkxyq9k2adv1zf2",
3+
"rev": "f38f159df7d2b3a716c344edff4c9f630e070453",
4+
"date": "2021-01-24T01:11:02+00:00",
5+
"path": "/nix/store/fsgz8y98a4yrhw3slj159kmkv39bb561-hackage.nix-f38f159",
6+
"sha256": "163gabnkvap4x5mpdriknhi5bz8a9mkgfq5msp5ddzm02iqw6b5v",
77
"fetchSubmodules": false,
88
"deepClone": false,
99
"leaveDotGit": false

lib/cabal-licenses.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ in licenses // {
1414
shortName = "Other License";
1515
fullName = "Unidentified Other License";
1616
url = "https://spdx.github.io/spdx-spec/appendix-IV-SPDX-license-expressions/";
17-
free = false;
17+
# Not setting `free` here. The license may or may not be `free`.
18+
# See https://github.com/input-output-hk/haskell.nix/pull/1006
1819
};
1920
NONE = null;
2021
}

lib/check.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ in stdenv.mkDerivation ({
2828
# component and we want it to quietly succeed.
2929
buildPhase = ''
3030
mkdir $out
31+
${
32+
# Change to the source sub directory if there is one.
33+
lib.optionalString (drv.srcSubDir or "" != "") ''
34+
cd ${lib.removePrefix "/" drv.srcSubDir}
35+
''
36+
}
3137
3238
runHook preCheck
3339

lib/clean-cabal-component.nix

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,20 @@ in
5858
hsSourceDirs = builtins.map (d: combinePaths subDir d) component.hsSourceDirs
5959
++ (if component.hsSourceDirs == [] then [subDir] else []);
6060
includeDirs = builtins.map (d: combinePaths subDir d) component.includeDirs;
61-
dirsNeeded = builtins.map (d: combinePaths subDir d) (
61+
# paths that will be needed (used to check if a parent dir should be included)
62+
dirsNeeded =
63+
# These already include subDir
6264
[dataDir]
6365
++ hsSourceDirs
6466
++ includeDirs
65-
++ package.licenseFiles
66-
++ package.extraSrcFiles
67-
++ component.extraSrcFiles
68-
++ package.extraDocFiles
69-
++ builtins.map (f: dataDir + f) package.dataFiles
70-
++ otherSourceFiles);
67+
++ builtins.map (f: combinePaths dataDir f) package.dataFiles
68+
++ otherSourceFiles
69+
++ builtins.map (d: combinePaths subDir d) (
70+
# These need the subDir added
71+
package.licenseFiles
72+
++ package.extraSrcFiles
73+
++ component.extraSrcFiles
74+
++ package.extraDocFiles);
7175
fileMatch = dir: list:
7276
let
7377
prefixes = builtins.map (f: combinePaths dir f) (

lib/import-and-filter-project.nix

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,43 @@ in project // {
2424
packages = pkgs.lib.attrsets.mapAttrs (name: value:
2525
if builtins.isFunction value
2626
then value
27-
else {...}@args:
28-
let oldPkg = import value args;
29-
packageSrc = if !pkgs.lib.strings.hasPrefix (toString projectNix) (toString oldPkg.src.content)
30-
then toString oldPkg.src.content
31-
else let
32-
subDir = pkgs.lib.strings.removePrefix "/" (
33-
pkgs.lib.strings.removePrefix (toString projectNix)
34-
(toString oldPkg.src.content));
35-
srcRepoPrefix = projectSubDir'' + ".source-repository-packages/";
36-
in if pkgs.lib.strings.hasPrefix srcRepoPrefix subDir
37-
then
38-
pkgs.lib.lists.elemAt sourceRepos (
39-
pkgs.lib.strings.toInt (pkgs.lib.strings.removePrefix srcRepoPrefix subDir))
40-
else haskellLib.appendSubDir {
41-
src = srcRoot;
42-
inherit subDir;
43-
includeSiblings = true; # Filtering sibling dirs of the package dir is done in the
44-
# component builder so that relative paths can be used to
45-
# reference project directories not in the package subDir.
46-
};
27+
else {...}@args: with pkgs.lib.strings;
28+
let
29+
oldPkg = import value args;
30+
# When the package src is in the project dir, this is the subDir it is in.
31+
subDir = removePrefix "/" (removePrefix (toString projectNix)
32+
(toString oldPkg.src.content));
33+
srcRepoPrefix = projectSubDir'' + ".source-repository-packages/";
34+
35+
packageInfo =
36+
if !hasPrefix (toString projectNix) (toString oldPkg.src.content)
37+
then {
38+
# Source location does not match project prefix
39+
isProject = false;
40+
packageSrc = toString oldPkg.src.content;
41+
}
42+
else if hasPrefix srcRepoPrefix subDir
43+
then {
44+
# The source is from a source repository
45+
isProject = false;
46+
packageSrc = pkgs.lib.lists.elemAt sourceRepos (
47+
toInt (removePrefix srcRepoPrefix subDir));
48+
}
49+
else {
50+
# Source does match project prefix and it is not from a source repository
51+
isProject = true;
52+
packageSrc = haskellLib.appendSubDir {
53+
src = srcRoot;
54+
inherit subDir;
55+
includeSiblings = true; # Filtering sibling dirs of the package dir is done in the
56+
# component builder so that relative paths can be used to
57+
# reference project directories not in the package subDir.
58+
};
59+
};
4760
in oldPkg // {
48-
src = (pkgs.lib).mkDefault packageSrc;
61+
src = (pkgs.lib).mkDefault packageInfo.packageSrc;
4962
package = oldPkg.package // {
50-
isProject = (pkgs.lib).mkDefault true;
63+
isProject = (pkgs.lib).mkDefault packageInfo.isProject;
5164
};
5265
}) old;
5366
};

lib/pkgconf-nixpkgs-map.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ pkgs:
155155
"webkit2gtk-4.0" = [ pkgs."webkitgtk" ];
156156
"webkit2gtk-web-extension-4.0" = [ pkgs."webkitgtk" ];
157157
"webkitgtk-3.0" = [ pkgs."webkitgtk24x-gtk3" ]; # These are the old APIs, of which 2.4 is the last provider, so map directly to that
158+
"vulkan" = [ pkgs."vulkan-loader" ]; # vulkan-loader provides vulkan.pc file for pkg-config.
158159
"X11" = [ pkgs.xorg."libX11" ];
159160
"x11" = [ pkgs.xorg."xlibsWrapper" ];
160161
"xau" = [ pkgs.xorg."libXau" ];

lib/system-nixpkgs-map.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ with pkgs;
1313
"stdc++-6" = null;
1414
ssl = [ openssl ];
1515
z = [ zlib ];
16+
pcap = [ libpcap ];
1617
pthread = null; # available by default
1718
GL = [ libGL ];
1819
GLU = [ libGLU ];
@@ -73,6 +74,9 @@ with pkgs;
7374
boost_wave = [ boost ];
7475
boost_wserialization = [ boost ];
7576
tensorflow = [ libtensorflow ];
77+
# odbc package requires unixODBC packages to be installed in order to successfully
78+
# compile C sources (https://github.com/fpco/odbc/blob/master/cbits/odbc.c)
79+
odbc = [ unixODBC ];
7680
opencv = [ opencv3 ];
7781
icuuc = [ icu ];
7882
icui18n = [ icu ];

0 commit comments

Comments
 (0)