Skip to content

Commit 7d482e9

Browse files
committed
Merge branch 'master' of github.com:input-output-hk/haskell.nix into circuithub
2 parents c6346a9 + 26822ba commit 7d482e9

File tree

373 files changed

+41977
-921
lines changed

Some content is hidden

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

373 files changed

+41977
-921
lines changed

.github/workflows/lints.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: "Lints"
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- master
8+
9+
push:
10+
branches:
11+
- master
12+
13+
defaults:
14+
run:
15+
shell: bash
16+
17+
# do we really want nixos-unstable?
18+
env:
19+
NIX_PATH: "nixpkgs=channel:nixos-unstable"
20+
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
22+
jobs:
23+
deadnix:
24+
runs-on: [self-hosted, linux]
25+
steps:
26+
- uses: actions/checkout@v3
27+
- run: |
28+
nix run github:astro/deadnix -- --edit --no-lambda-pattern-names
29+
TMPFILE=$(mktemp)
30+
git diff >"${TMPFILE}"
31+
git stash -u && git stash drop
32+
nix-shell -p reviewdog --run "reviewdog -f=diff -f.diff.strip=1 -reporter=github-pr-review < \"${TMPFILE}\""

.github/workflows/pipeline.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ jobs:
123123
- name: "Run tests with ghc8107: End-2-end test of hix project initialization and flakes development shell ..."
124124
run: "./test/tests.sh ghc8107 hix"
125125

126+
# template:
127+
# runs-on: [self-hosted, linux]
128+
# steps:
129+
# - uses: actions/checkout@v3
130+
# - name: "Run tests with ghc8107: End-2-end test of hix project initialization and flakes development shell ..."
131+
# run: "./test/tests.sh ghc8107 template"
132+
126133
docs:
127134
runs-on: [self-hosted, linux]
128135
steps:

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ cabal.sandbox.config
7878
*.hp
7979
*.eventlog
8080
.stack-work/
81-
cabal.project.local
8281
cabal.project.local~
8382
.HTF/
8483
.ghc.environment.*

build.nix

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ in rec {
2525

2626
tools = pkgs.lib.optionalAttrs (ifdLevel >= 3) (
2727
pkgs.recurseIntoAttrs ({
28-
cabal-latest = tool compiler-nix-name "cabal" { inherit evalPackages; };
28+
cabal-latest = tool compiler-nix-name "cabal" { inherit evalPackages; cabalProjectLocal = builtins.readFile ./test/cabal.project.local; };
2929
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.6" < 0) {
3030
hlint-latest = tool compiler-nix-name "hlint" {
3131
inherit evalPackages;
@@ -43,13 +43,12 @@ in rec {
4343
"ghc8107" = "3.4.1";
4444
}.${compiler-nix-name} or "latest";
4545
};
46-
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.6" < 0) {
46+
} // pkgs.lib.optionalAttrs (
47+
__compareVersions haskell.compiler.${compiler-nix-name}.version "9.2" >= 0
48+
&& __compareVersions haskell.compiler.${compiler-nix-name}.version "9.6" < 0) {
4749
stack =
4850
tool compiler-nix-name "stack" {
49-
version =
50-
if __compareVersions haskell.compiler.${compiler-nix-name}.version "9.2" < 0
51-
then "2.9.3.1"
52-
else "2.11.1";
51+
version = "2.11.1";
5352
inherit evalPackages;
5453
};
5554
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.6" < 0) {
@@ -62,6 +61,11 @@ in rec {
6261
inherit evalPackages;
6362
src = pkgs.haskell-nix.sources."hls-2.0";
6463
};
64+
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.8" < 0) {
65+
"hls-22" = tool compiler-nix-name "haskell-language-server" {
66+
inherit evalPackages;
67+
src = pkgs.haskell-nix.sources."hls-2.2";
68+
};
6569
})
6670
);
6771

@@ -73,17 +77,15 @@ in rec {
7377
update-hackage = import ./scripts/update-hackage.nix {
7478
inherit (pkgs) stdenv lib writeScript coreutils glibc git
7579
openssh nixFlakes gawk bash curl findutils;
76-
# Update scripts use the internal nix-tools and cabal-install (compiled with a fixed GHC version)
77-
nix-tools = haskell.internal-nix-tools;
78-
cabal-install = haskell.internal-cabal-install;
80+
# Update scripts use the internal nix-tools (compiled with a fixed GHC version)
81+
nix-tools = haskell.nix-tools-unchecked;
7982
inherit (haskell) update-index-state-hashes cabal-issue-8352-workaround;
8083
};
8184
update-stackage = haskell.callPackage ./scripts/update-stackage.nix {
8285
inherit (pkgs) stdenv lib writeScript coreutils glibc git
8386
openssh nixFlakes gawk bash curl findutils;
84-
# Update scripts use the internal nix-tools and cabal-install (compiled with a fixed GHC version)
85-
nix-tools = haskell.internal-nix-tools;
86-
cabal-install = haskell.internal-cabal-install;
87+
# Update scripts use the internal nix-tools (compiled with a fixed GHC version)
88+
nix-tools = haskell.nix-tools-unchecked;
8789
inherit (haskell) cabal-issue-8352-workaround;
8890
};
8991
update-pins = haskell.callPackage ./scripts/update-pins.nix {};

builder/Setup.ghcjs.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ linkCLib libname desc lbi = do
122122
-- getTempRet0/setTempRet0 are for 64bit legalization.
123123
, "-s", "EXPORTED_RUNTIME_METHODS=['printErr','addFunction','removeFunction','getTempRet0','setTempRet0']"
124124
--
125-
, "-s", "EXPORTED_FUNCTIONS=['" <> intercalate "', '" exfns <> "']"
125+
, "-s", "EXPORTED_FUNCTIONS=[" <> intercalate ", " (map (\f -> "'" <> f <> "'") exfns) <> "]"
126126
] ++ libs ++ libDirs ++ extraLibs
127127

128128
postBuildHook :: Args -> BuildFlags -> PackageDescription -> LocalBuildInfo -> IO ()

builder/comp-builder.nix

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ let self =
4040

4141
, dontPatchELF ? component.dontPatchELF
4242
, dontStrip ? component.dontStrip
43+
, dontUpdateAutotoolsGnuConfigScripts ? component.dontUpdateAutotoolsGnuConfigScripts
4344
, hardeningDisable ? component.hardeningDisable
4445

4546
, enableStatic ? component.enableStatic
@@ -188,15 +189,23 @@ let
188189
"--with-ar=${stdenv.cc.bintools.targetPrefix}ar"
189190
"--with-strip=${stdenv.cc.bintools.targetPrefix}strip"
190191
]
191-
) ++ [ # other flags
192+
) # Starting with ghc 9.10 the `ld command` will no longer be in the GHC `settings` file.
193+
# We need to start passing it explicitly to setup like we do for `ar` and `strip`.
194+
++ lib.optional (!stdenv.hostPlatform.isGhcjs && builtins.compareVersions defaults.ghc.version "9.8" >= 0)
195+
"--with-ld=${stdenv.cc.bintools.targetPrefix}ld"
196+
++ lib.optionals (stdenv.hostPlatform.isGhcjs) [
197+
"--with-gcc=${buildPackages.emscripten}/bin/emcc"
198+
"--with-ld=${buildPackages.emscripten}/bin/emcc"
199+
]
200+
++ [ # other flags
192201
(disableFeature dontStrip "executable-stripping")
193202
(disableFeature dontStrip "library-stripping")
194203
(enableFeature enableLibraryProfiling "library-profiling")
195204
(enableFeature enableProfiling "profiling")
196205
(enableFeature enableStatic "static")
197206
(enableFeature enableShared "shared")
198207
(enableFeature doCoverage "coverage")
199-
(enableFeature enableLibraryForGhci "library-for-ghci")
208+
(enableFeature (enableLibraryForGhci && !stdenv.hostPlatform.isGhcjs) "library-for-ghci")
200209
] ++ lib.optionals (stdenv.hostPlatform.isMusl && (haskellLib.isExecutableType componentId)) [
201210
# These flags will make sure the resulting executable is statically linked.
202211
# If it uses other libraries it may be necessary for to add more
@@ -223,7 +232,7 @@ let
223232
++ lib.optionals useLLVM [
224233
"--ghc-option=-fPIC" "--gcc-option=-fPIC"
225234
]
226-
++ map (o: ''--ghc${lib.optionalString stdenv.hostPlatform.isGhcjs "js"}-options="${o}"'') ghcOptions
235+
++ map (o: ''--ghc${lib.optionalString (stdenv.hostPlatform.isGhcjs && builtins.compareVersions defaults.ghc.version "9" < 0) "js"}-options="${o}"'') ghcOptions
227236
++ lib.optional (
228237
# GHC 9.2 cross compiler built with older versions of GHC seem to have problems
229238
# with unique conters. Perhaps because the name changed for the counters.
@@ -261,8 +270,9 @@ let
261270
if builtins.isFunction shellHook then shellHook { inherit package shellWrappers; }
262271
else abort "shellHook should be a string or a function";
263272

264-
exeExt = if stdenv.hostPlatform.isGhcjs then ".jsexe/all.js" else
265-
stdenv.hostPlatform.extensions.executable;
273+
exeExt = if stdenv.hostPlatform.isGhcjs && builtins.compareVersions defaults.ghc.version "9.8" < 0
274+
then ".jsexe/all.js"
275+
else stdenv.hostPlatform.extensions.executable;
266276
exeName = componentId.cname + exeExt;
267277
testExecutable = "dist/build/${componentId.cname}/${exeName}";
268278

@@ -295,10 +305,8 @@ let
295305
(if cabalFile != null
296306
then ''cp -v $cabalFilePath ${package.identifier.name}.cabal''
297307
else
298-
# When building hpack package we use the internal nix-tools
299-
# (compiled with a fixed GHC version)
300308
lib.optionalString (cabal-generator == "hpack") ''
301-
${buildPackages.haskell-nix.internal-nix-tools}/bin/hpack
309+
${buildPackages.haskell-nix.nix-tools-unchecked}/bin/hpack
302310
''
303311
) + lib.optionalString (prePatch != null) "\n${prePatch}";
304312
}
@@ -320,6 +328,9 @@ let
320328
// lib.optionalAttrs stdenv.hostPlatform.isMusl {
321329
# This fixes musl compilation of TH code that depends on C++ (for instance TH code that uses the double-conversion package)
322330
LD_LIBRARY_PATH="${pkgs.buildPackages.gcc-unwrapped.lib}/x86_64-unknown-linux-musl/lib";
331+
}
332+
// lib.optionalAttrs dontUpdateAutotoolsGnuConfigScripts {
333+
inherit dontUpdateAutotoolsGnuConfigScripts;
323334
};
324335

325336
haddock = haddockBuilder {
@@ -534,7 +545,7 @@ let
534545
# we assume that if the SETUP_HS command fails and the following line was found in the error
535546
# log, that it was the only error. Hence if we do _not_ find the line, grep will fail and this derivation
536547
# will be marked as failure.
537-
cat $SETUP_ERR | grep 'Error: Setup: No executables and no library found\. Nothing to do\.'
548+
cat $SETUP_ERR | grep 'No executables and no library found\. Nothing to do\.'
538549
fi
539550
''}
540551
${lib.optionalString (haskellLib.isLibrary componentId) ''
@@ -586,13 +597,13 @@ let
586597
'')
587598
}
588599
''}
589-
${(lib.optionalString (haskellLib.isTest componentId || haskellLib.isBenchmark componentId) ''
600+
${(lib.optionalString (haskellLib.isTest componentId || haskellLib.isBenchmark componentId || (haskellLib.isExe componentId && stdenv.hostPlatform.isGhcjs)) ''
590601
mkdir -p $out/bin
591602
if [ -f ${testExecutable} ]; then
592603
mkdir -p $(dirname $out/bin/${exeName})
593604
${lib.optionalString stdenv.buildPlatform.isLinux "sync"}
594-
${if stdenv.hostPlatform.isGhcjs then ''
595-
cat <(echo \#!${lib.getBin buildPackages.nodejs-18_x}/bin/node) ${testExecutable} >| $out/bin/${exeName}
605+
${if stdenv.hostPlatform.isGhcjs && builtins.compareVersions defaults.ghc.version "9.8" < 0 then ''
606+
cat <(echo \#!/usr/bin/env node) ${testExecutable} >| $out/bin/${exeName}
596607
chmod +x $out/bin/${exeName}
597608
'' else ''
598609
cp -r ${testExecutable} $(dirname $out/bin/${exeName})
@@ -609,8 +620,8 @@ let
609620
# Also include C++ and mcfgthreads DLLs for GHC 9.4.1 and newer
610621
lib.optionals (builtins.compareVersions defaults.ghc.version "9.4.1" >= 0)
611622
[ buildPackages.gcc-unwrapped
612-
# Find the versions of mfcgthreads used by stdenv.cc
613-
(pkgs.threadsCrossFor or (x: windows.mfcgthreads) stdenv.cc.version).package
623+
# Find the versions of mcfgthreads used by stdenv.cc
624+
(pkgs.threadsCrossFor or (_x: { package = pkgs.windows.mcfgthreads; }) pkgs.stdenv.cc.version).package
614625
])}; do
615626
find "$p" -iname '*.dll' -exec ln -s {} $out/bin \;
616627
done

builder/haddock-builder.nix

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ let
121121
'';
122122

123123
installPhase =
124-
let
125-
target-pkg-and-db = "${ghc.targetPrefix}ghc-pkg -v0 --package-db $out/package.conf.d";
126-
in ''
124+
''
127125
html="dist/doc/html/${package.identifier.name}"
128126
129127
if [ -d "$html" ]; then

builder/make-config-files.nix

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,7 @@ let
3737
# pkg id for z-{pkg name}-z-{sublib name}. As we do not provide the
3838
# sublib name to exactDep, as we don't have access to it at the call-site,
3939
# we resort to a bit of globbing, which (as pkg db's should contain only
40-
# a single package) work.
41-
42-
getLibComponent = dep:
43-
dep.components.library # Regular package dependency
44-
or dep; # or a sublib
40+
# a single package) work. # or a sublib
4541

4642
# Work our suitable packageCfgDir subdirectory
4743
isGhcjs = ghc.isGhcjs or false;

ci-lib.nix

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
{
2-
# Generic nixpkgs, use *only* for lib functions that are stable across versions
3-
pkgs,
4-
lib ? pkgs.lib
5-
}: rec {
1+
{ lib }:
2+
rec {
63
inherit (import ./dimension.nix) dimension;
74

85
# A filter for removing packages that aren't supported on the current platform
@@ -23,7 +20,7 @@
2320
# Keep derivations and attrsets with 'recurseForDerivations'. This ensures that we match the
2421
# derivations that Hercules will see, and prevents Hydra from trying to pick up all sorts of bad stuff
2522
# (like attrsets that contain themselves!).
26-
filterDerivations = filterAttrsOnlyRecursive (n: attrs: lib.isDerivation attrs || attrs.recurseForDerivations or false);
23+
filterDerivations = filterAttrsOnlyRecursive (_n: attrs: lib.isDerivation attrs || attrs.recurseForDerivations or false);
2724

2825
# A version of 'filterAttrsRecursive' that doesn't recurse into derivations. This prevents us from going into an infinite
2926
# loop with the 'out' attribute on derivations.

0 commit comments

Comments
 (0)