Skip to content

Commit f574a03

Browse files
committed
Merge branch 'master' of github.com:input-output-hk/haskell.nix into circuithub
2 parents 6cf19f0 + d144862 commit f574a03

File tree

202 files changed

+31843
-502
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+31843
-502
lines changed

build.nix

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ in rec {
4242
};
4343
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.4" < 0) {
4444
stack = tool compiler-nix-name "stack" { version = "2.9.3"; inherit evalPackages; };
45-
hls-latest = tool compiler-nix-name "haskell-language-server" {
45+
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.6" < 0) {
46+
hls-latest = tool compiler-nix-name "haskell-language-server" rec {
4647
inherit evalPackages;
47-
version =
48-
if __compareVersions haskell.compiler.${compiler-nix-name}.version "9.0" < 0
49-
then "1.8.0.0"
50-
else "latest";
48+
src = pkgs.haskell-nix.sources."hls-1.10";
49+
cabalProject = __readFile (src + "/cabal.project");
50+
sha256map."https://github.com/pepeiborra/ekg-json"."7a0af7a8fd38045fd15fb13445bdcc7085325460" = "sha256-fVwKxGgM0S4Kv/4egVAAiAjV7QB5PBqMVMCfsv7otIQ=";
5151
};
5252
})
5353
);

builder/comp-builder.nix

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ let self =
1414

1515
, preUnpack ? component.preUnpack, postUnpack ? component.postUnpack
1616
, configureFlags ? component.configureFlags
17+
, prePatch ? component.prePatch, postPatch ? component.postPatch
1718
, preConfigure ? component.preConfigure, postConfigure ? component.postConfigure
1819
, setupBuildFlags ? component.setupBuildFlags
1920
, preBuild ? component.preBuild , postBuild ? component.postBuild
@@ -43,9 +44,6 @@ let self =
4344

4445
, enableStatic ? component.enableStatic
4546
, enableShared ? ghc.enableShared && component.enableShared && !haskellLib.isCrossHost
46-
# on x86 we'll use shared libraries, even with musl m(
47-
# ghc's internal linker seems to be broken on x86.
48-
&& !(stdenv.hostPlatform.isMusl && !stdenv.hostPlatform.isx86)
4947
, enableDeadCodeElimination ? component.enableDeadCodeElimination
5048
, writeHieFiles ? component.writeHieFiles
5149

@@ -290,7 +288,7 @@ let
290288
lib.optionalString (cabal-generator == "hpack") ''
291289
${buildPackages.haskell-nix.internal-nix-tools}/bin/hpack
292290
''
293-
);
291+
) + lib.optionalString (prePatch != null) "\n${prePatch}";
294292
}
295293
# patches can (if they like) depend on the version of the package.
296294
// lib.optionalAttrs (patches != []) {
@@ -302,7 +300,7 @@ let
302300
}
303301
// haskellLib.optionalHooks {
304302
# These are hooks are needed to set up the source for building and running haddock
305-
inherit preUnpack postUnpack preConfigure postConfigure;
303+
inherit preUnpack postUnpack postPatch preConfigure postConfigure;
306304
}
307305
// lib.optionalAttrs (stdenv.buildPlatform.libc == "glibc") {
308306
LOCALE_ARCHIVE = "${buildPackages.glibcLocales}/lib/locale/locale-archive";

builder/default.nix

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
1-
{ pkgs, buildPackages, evalPackages, stdenv, lib, haskellLib, ghc, compiler-nix-name, fetchurl, nonReinstallablePkgs, hsPkgs, compiler, inputMap }:
1+
# While creating the nix build plan, we take care to create package derivations
2+
# that do not include any reference to the plan itself or how it is created.
3+
#
4+
# This allows haskell.nix to share packages between plans (at least when they
5+
# have identical dependencies). If the package derivations included the hash of
6+
# the plan derivation, different plans would always produce different packages
7+
# and there could not be any sharing of packages between plans.
8+
#
9+
# Any wrangling of the project dependencies (e.g. fetching package indices,
10+
# source-repository-packages or any other asset required for building) *has* to
11+
# be performed during planning. The nix build plan will import any remote asset
12+
# through a fixed-output derivations (i.e. a call to a fetcher).
13+
#
14+
# tl;dr: the builder must not re-introduce any reference to the build plan.
15+
16+
{ pkgs, buildPackages, evalPackages, stdenv, lib, haskellLib, ghc, compiler-nix-name, fetchurl, nonReinstallablePkgs, hsPkgs, compiler }:
217

318
let
419
# Builds a single component of a package.
@@ -85,7 +100,7 @@ in {
85100
# Build a Haskell package from its config.
86101
# TODO: this pkgs is the adjusted pkgs, but pkgs.pkgs is unadjusted
87102
build-package = haskellLib.weakCallPackage pkgs ./hspkg-builder.nix {
88-
inherit haskellLib ghc compiler-nix-name comp-builder setup-builder inputMap;
103+
inherit haskellLib ghc compiler-nix-name comp-builder setup-builder;
89104
};
90105

91106
inherit shellFor makeConfigFiles;

builder/hspkg-builder.nix

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ pkgs, buildPackages, stdenv, lib, haskellLib, ghc, compiler-nix-name, fetchurl, runCommand, comp-builder, setup-builder, inputMap }:
1+
{ pkgs, buildPackages, stdenv, lib, haskellLib, ghc, compiler-nix-name, fetchurl, runCommand, comp-builder, setup-builder }:
22

33
config:
44
{ flags
@@ -24,24 +24,9 @@ let
2424
"ghc902/stm-2.5.0.0" = "/libraries/stm";
2525
"ghc902/filepath-1.4.2.1" = "/libraries/filepath";
2626
}."${compiler-nix-name}/${name}" or null;
27-
baseUrlMatch =
28-
let
29-
# All the urls that should contain the source
30-
srcUrls = lib.optional (pkg.src ? url) pkg.src.url ++ pkg.src.urls or [];
31-
in __head (
32-
# Look for one that matches the expected pattern
33-
builtins.filter (x: x != null) (
34-
map (__match "(.*)/package/([^/]*)") srcUrls)
35-
# Return null if none do
36-
++ [null]);
3727
src =
3828
if bundledSrc != null
3929
then ghc.configured-src + bundledSrc
40-
else if baseUrlMatch != null && inputMap ? ${__head baseUrlMatch}
41-
then
42-
# Use the copy of the package that is in the inputMap for this
43-
# repository.
44-
inputMap.${__head baseUrlMatch} + "/package/${__elemAt baseUrlMatch 1}"
4530
else pkg.src;
4631

4732
cabalFile = if package-description-override == null || bundledSrc != null then null else package-description-override;

ci.nix

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@
5151
ghc8107 = false;
5252
ghc902 = false;
5353
ghc927 = false;
54-
ghc944 = false;
54+
ghc945 = false;
5555
} // nixpkgs.lib.optionalAttrs (nixpkgsName == "unstable") {
5656
ghc884 = false;
5757
ghc8107 = true;
5858
ghc902 = false;
5959
ghc927 = true;
60-
ghc944 = true;
60+
ghc945 = true;
6161
ghc961 = true;
6262
}));
6363
crossSystems = nixpkgsName: nixpkgs: compiler-nix-name:
@@ -72,13 +72,18 @@
7272
)) {
7373
inherit (lib.systems.examples) ghcjs;
7474
} // lib.optionalAttrs (nixpkgsName == "unstable"
75-
&& ((system == "x86_64-linux" && __elem compiler-nix-name ["ghc8107" "ghc902" "ghc926" "ghc927" "ghc944" "ghc961"])
75+
&& ((system == "x86_64-linux" && __elem compiler-nix-name ["ghc8107" "ghc902" "ghc926" "ghc927" "ghc945" "ghc961"])
7676
|| (system == "x86_64-darwin" && __elem compiler-nix-name []))) { # TODO add ghc versions when we have more darwin build capacity
7777
inherit (lib.systems.examples) mingwW64;
78-
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && __elem compiler-nix-name ["ghc8107" "ghc902" "ghc922" "ghc923" "ghc924" "ghc926" "ghc927" "ghc944" "ghc961"]) {
78+
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && __elem compiler-nix-name ["ghc8107" "ghc902" "ghc922" "ghc923" "ghc924" "ghc926" "ghc927" "ghc945" "ghc961"]) {
7979
# Musl cross only works on linux
8080
# aarch64 cross only works on linux
8181
inherit (lib.systems.examples) musl64 aarch64-multiplatform;
82+
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && __elem compiler-nix-name ["ghc927"]) {
83+
# TODO fix this for the compilers we build with hadrian (ghc >=9.4)
84+
inherit (lib.systems.examples) aarch64-multiplatform-musl;
85+
} // lib.optionalAttrs (system == "aarch64-linux" && nixpkgsName == "unstable" && __elem compiler-nix-name ["ghc927" "ghc944" "ghc961"]) {
86+
inherit (lib.systems.examples) aarch64-multiplatform-musl;
8287
};
8388
isDisabled = d: d.meta.disabled or false;
8489
in

compiler/ghc/default.nix

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,7 @@ let
231231
# value for us.
232232
installStage1 = useHadrian && (haskell-nix.haskellLib.isCrossTarget || stdenv.targetPlatform.isMusl);
233233

234-
inherit ((buildPackages.haskell-nix.cabalProject {
235-
compiler-nix-name = "ghc8107";
234+
hadrian = buildPackages.haskell-nix.tool "ghc8107" "hadrian" {
236235
compilerSelection = p: p.haskell.compiler;
237236
index-state = buildPackages.haskell-nix.internalHackageIndexState;
238237
# Verions of hadrian that comes with 9.6 depends on `time`
@@ -242,15 +241,23 @@ let
242241
else if builtins.compareVersions ghc-version "9.6" < 0
243242
then ../../materialized/ghc8107/hadrian-ghc94
244243
else ../../materialized/ghc8107/hadrian-ghc96;
244+
modules = [{
245+
# Apply the patches in a way that does not require using somethin
246+
# like `srcOnly`. The problem with `pkgs.srcOnly` was that it had to run
247+
# on a platform at eval time.
248+
packages.hadrian.prePatch = ''
249+
cd ..
250+
'';
251+
packages.hadrian.patches = ghc-patches;
252+
packages.hadrian.postPatch = ''
253+
cd hadrian
254+
'';
255+
}];
245256
src = haskell-nix.haskellLib.cleanSourceWith {
246-
src = buildPackages.srcOnly {
247-
name = "hadrian";
248-
inherit src;
249-
patches = ghc-patches;
250-
};
257+
inherit src;
251258
subDir = "hadrian";
252259
};
253-
}).hsPkgs.hadrian.components.exes) hadrian;
260+
};
254261

255262
# For a discription of hadrian command line args
256263
# see https://gitlab.haskell.org/ghc/ghc/blob/master/hadrian/README.md

docs/dev/installing-nix-tools.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ To build the latest `nix-tools` and store the result at `./nt`, run:
66
nix build -f https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz pkgs.haskell-nix.nix-tools.ghc884 --out-link nt
77
```
88

9-
If you would like to then install `nix-tools` into your profile, run:
9+
If you would like to then install `nix-tools` into your profile, run an install
10+
command:
1011

1112
```shell
1213
nix-env -i ./nt
14+
nix profile install ./nt
1315
```
1416

1517
## Optional: Installing via [Haskell.nix][] source

docs/troubleshooting.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@ If you think you are doing all of these and you still find you're building GHC,
1515
### Why am I building lots of Haskell packages?
1616

1717
We don't generally cache much of Hackage (there's a lot of it!), except for the parts which are used by our tests.
18-
So this is expected, unfortunately.
18+
So this is expected, unfortunately. However, if you are building from a recent branch without significant dependencies
19+
changes, most of those dependencies should be cached and you should not be building core things like `Cabal` or `ghc-lib`.
20+
21+
If this happens, chances are nix cache are either:
22+
* Incorrectly configured: Check the aforementioned links,
23+
* Overriding global configuration in `/etc/nix/nix.conf` with local `~/.config/nix/nix.conf`. This can happen if for example
24+
one project is using `nix flake` with some locally configured repositories, while another project is not.
25+
Use `nix show-config` to check which caches are defined, then update or remove `~/.config/nix/nix.conf`.
1926

2027
### How do I prevent the evaluation-time dependencies of my project from being garbage-collected?
2128

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
@@ -11,6 +11,7 @@
1111
nixpkgs-unstable = { url = "github:NixOS/nixpkgs/nixpkgs-unstable"; };
1212
flake-compat = { url = "github:input-output-hk/flake-compat/hkm/gitlab-fix"; flake = false; };
1313
flake-utils = { url = "github:hamishmack/flake-utils/hkm/nested-hydraJobs"; };
14+
"hls-1.10" = { url = "github:haskell/haskell-language-server/1.10.0.0"; flake = false; };
1415
tullia = {
1516
url = "github:input-output-hk/tullia";
1617
inputs.nixpkgs.follows = "nixpkgs";

0 commit comments

Comments
 (0)