Skip to content

Commit 225365a

Browse files
committed
Merge remote-tracking branch 'upstream/master' into mpj/bump-haskell-nix
2 parents 9a3ae43 + f7bea98 commit 225365a

Some content is hidden

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

53 files changed

+9357
-269
lines changed

.github/workflows/pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ jobs:
239239
- name: "Check hix -- run github:haskell/cabal/3.10#cabal-install:exe:cabal -- --version"
240240
run: "HIX_DIR=$(mktemp -d) nix run .#hix --accept-flake-config -- run github:haskell/cabal/3.10#cabal-install:exe:cabal --accept-flake-config --override-input haskellNix . -- --version"
241241

242-
nix-tools:
242+
check-nix-tools:
243243
runs-on: [self-hosted, linux]
244244
steps:
245245
- uses: actions/checkout@v4

.github/workflows/update-docs.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Updload Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
env:
9+
GH_TOKEN: ${{ github.token }}
10+
11+
jobs:
12+
upload-docs:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Install Nix with good defaults
20+
uses: input-output-hk/install-nix-action@v20
21+
with:
22+
extra_nix_config: |
23+
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk=
24+
substituters = https://cache.nixos.org/ https://cache.iog.io/ https://cache.zw3rk.com
25+
nix_path: nixpkgs=channel:nixos-unstable
26+
27+
- name: Update docs
28+
run: |
29+
nix-build build.nix -A maintainer-scripts.update-docs -o update-docs.sh
30+
./update-docs.sh
31+
32+
- name: Upload docs
33+
run: |
34+
git config --global user.name 'Auto Update Bot'
35+
git config --global user.email '[email protected]'
36+
git push origin gh-pages

.github/workflows/upload-artifacts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Wait for Hydra Build
1+
name: Update Static Nix Tools
22

33
on:
44
push:

build.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ in rec {
5757
inherit evalPackages;
5858
src = pkgs.haskell-nix.sources."hls-2.2";
5959
};
60-
} // pkgs.lib.optionalAttrs (ghcFromTo "9.0" "9.10.2") {
60+
} // pkgs.lib.optionalAttrs (ghcFromTo "9.0" "9.13") {
6161
"hls" = tool compiler-nix-name "haskell-language-server" {
6262
inherit evalPackages;
63-
src = pkgs.haskell-nix.sources."hls-2.10";
63+
src = pkgs.haskell-nix.sources."hls-2.11";
6464
};
6565
})
6666
);

builder/comp-builder.nix

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ pkgs, stdenv, buildPackages, pkgsBuildBuild, ghc, lib, gobject-introspection ? null, haskellLib, makeConfigFiles, haddockBuilder, ghcForComponent, hsPkgs, compiler, runCommand, libffi, gmp, windows, zlib, ncurses, nodejs, nonReinstallablePkgs }@defaults:
1+
{ pkgs, stdenv, buildPackages, pkgsBuildBuild, ghc, llvmPackages, lib, gobject-introspection ? null, haskellLib, makeConfigFiles, haddockBuilder, ghcForComponent, hsPkgs, compiler, runCommand, libffi, gmp, windows, zlib, ncurses, nodejs, nonReinstallablePkgs }@defaults:
22
lib.makeOverridable (
33
let self =
44
{ componentId
@@ -383,7 +383,6 @@ let
383383
env = shellWrappers.drv;
384384
shell = drv.overrideAttrs (attrs: {
385385
pname = nameOnly + "-shell";
386-
inherit (package.identifier) version;
387386
nativeBuildInputs = [shellWrappers.drv] ++ attrs.nativeBuildInputs;
388387
});
389388
profiled = lib.makeOverridable self (drvArgs // { enableLibraryProfiling = true; });
@@ -431,7 +430,8 @@ let
431430
nativeBuildInputs =
432431
[ghc buildPackages.removeReferencesTo]
433432
++ executableToolDepends
434-
++ (lib.optional stdenv.hostPlatform.isGhcjs buildPackages.nodejs);
433+
++ (lib.optional stdenv.hostPlatform.isGhcjs buildPackages.nodejs)
434+
++ (lib.optional (ghc.useLdLld or false) llvmPackages.bintools);
435435

436436
outputs = ["out"]
437437
++ (lib.optional keepConfigFiles "configFiles")
@@ -448,6 +448,10 @@ let
448448
(lib.optionalString stdenv.hostPlatform.isGhcjs ''
449449
export HOME=$(mktemp -d)
450450
export EM_CACHE=$(mktemp -d)
451+
if [ -d ${pkgsBuildBuild.emscripten}/share/emscripten/cache ]; then
452+
cp -r ${pkgsBuildBuild.emscripten}/share/emscripten/cache/* $EM_CACHE/
453+
chmod +w -R $EM_CACHE
454+
fi
451455
'') +
452456
(lib.optionalString (!canCleanSource) ''
453457
echo "Cleaning component source not supported, leaving it un-cleaned"
@@ -595,7 +599,6 @@ let
595599
(''
596600
if id=$(${target-pkg-and-db} field "z-${package.identifier.name}-z-*" id --simple-output); then
597601
name=$(${target-pkg-and-db} field "z-${package.identifier.name}-z-*" name --simple-output)
598-
echo "--dependency=''${name#z-${package.identifier.name}-z-}=$id" >> $out/exactDep/configure-flags
599602
echo "package-id $id" >> $out/envDep
600603
''
601604
# Allow `package-name:sublib-name` to work in `build-depends`

builder/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ let
7575

7676
# Same as haskellPackages.shellFor in nixpkgs.
7777
shellFor = haskellLib.weakCallPackage pkgs ./shell-for.nix {
78-
inherit hsPkgs ghcForComponent makeConfigFiles hoogleLocal haskellLib pkgsBuildBuild evalPackages compiler;
78+
inherit hsPkgs ghcForComponent makeConfigFiles hoogleLocal haskellLib pkgsBuildBuild evalPackages compiler ghc;
7979
inherit (buildPackages) glibcLocales;
8080
};
8181

builder/ghc-for-component-wrapper.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ let
3737
${lndir}/bin/lndir -silent $unwrappedGhc $wrappedGhc
3838
rm -rf ${libDir}/*/
3939
''
40-
# ... but retain the lib/ghc/bin directory. This contains `unlit' and friends.
40+
# ... but retain the lib/ghc/bin directory. This may contain `unlit' and friends.
4141
+ ''
4242
if [ -d $unwrappedGhc/lib/${ghcCommand}-${ghc.version}/bin ]; then
4343
ln -s $unwrappedGhc/lib/${ghcCommand}-${ghc.version}/bin ${libDir}
44-
else
44+
elif [ -d $unwrappedGhc/lib/bin ]; then
4545
ln -s $unwrappedGhc/lib/bin ${libDir}
4646
fi
4747
''

builder/haddock-builder.nix

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ stdenv, buildPackages, lib, haskellLib, ghc, ghcForComponent, nonReinstallablePkgs, runCommand, writeText, writeScript, makeConfigFiles }:
1+
{ stdenv, buildPackages, lib, haskellLib, ghc, ghcForComponent, nonReinstallablePkgs, runCommand, writeText, writeScript, makeConfigFiles, llvmPackages }:
22

33
{ componentId
44
, component
@@ -80,7 +80,8 @@ let
8080

8181
nativeBuildInputs =
8282
[ ghc buildPackages.removeReferencesTo ]
83-
++ componentDrv.executableToolDepends;
83+
++ componentDrv.executableToolDepends
84+
++ (lib.optional (ghc.useLdLld or false) llvmPackages.bintools);
8485

8586
configurePhase = ''
8687
mkdir -p $configFiles
@@ -109,6 +110,12 @@ let
109110
110111
# If we don't have any source files, no need to run haddock
111112
[[ -n $(find . -name "*.hs" -o -name "*.lhs") ]] && {
113+
# Run any preprocessor in the custom build step
114+
$SETUP_HS build \
115+
"--with-ghc=false" \
116+
${lib.optionalString (haskellLib.isTest componentId) "--tests"} \
117+
${lib.concatStringsSep " " setupHaddockFlags} || true
118+
112119
$SETUP_HS haddock \
113120
"--html" \
114121
${lib.optionalString (haskellLib.isTest componentId) "--tests"} \
@@ -151,8 +158,12 @@ let
151158
${ghc.targetPrefix}ghc-pkg -v0 --package-db $configFiles/${configFiles.packageCfgDir} -f $out/package.conf.d register "$pkg"
152159
done
153160
154-
ln -s ${componentDrv}/exactDep $out/exactDep
155-
ln -s ${componentDrv}/envDep $out/envDep
161+
if [ -d ${componentDrv}/exactDep ]; then
162+
ln -s ${componentDrv}/exactDep $out/exactDep
163+
fi
164+
if [ -f ${componentDrv}/envDep ]; then
165+
ln -s ${componentDrv}/envDep $out/envDep
166+
fi
156167
'';
157168
}
158169
// haskellLib.optionalHooks {

builder/setup-builder.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ pkgs, stdenv, lib, buildPackages, haskellLib, ghc, nonReinstallablePkgs, hsPkgs, makeSetupConfigFiles }@defaults:
1+
{ pkgs, stdenv, lib, buildPackages, haskellLib, ghc, nonReinstallablePkgs, hsPkgs, makeSetupConfigFiles, llvmPackages }@defaults:
22

33
let self =
44
{ component, package, name, src, enableDWARF ? false, flags ? {}, revision ? null, patches ? [], defaultSetupSrc
@@ -67,7 +67,7 @@ let
6767
++ builtins.concatLists component.pkgconfig
6868
++ configFiles.libDeps
6969
++ [ghc]; # Needs to be a build input so that the boot libraries are included
70-
nativeBuildInputs = [ghc] ++ executableToolDepends;
70+
nativeBuildInputs = [ghc] ++ executableToolDepends ++ (lib.optional (ghc.useLdLld or false) llvmPackages.bintools);
7171

7272
passthru = {
7373
inherit (package) identifier;

builder/shell-for.nix

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ lib, stdenv, mkShell, glibcLocales, ghcForComponent, makeConfigFiles, hsPkgs, hoogleLocal, haskellLib, pkgsBuildBuild, evalPackages, compiler }:
1+
{ lib, stdenv, mkShell, glibcLocales, ghcForComponent, makeConfigFiles, hsPkgs, hoogleLocal, haskellLib, pkgsBuildBuild, evalPackages, compiler, haskell-nix, ghc }:
22

33
{ # `packages` function selects packages that will be worked on in the shell itself.
44
# These packages will not be built by `shellFor`, but their
@@ -93,6 +93,11 @@ let
9393
(removeSelectedInputs (haskellLib.uniqueWithName (lib.concatMap (cfg: cfg.depends) selectedConfigs))
9494
++ additionalPackages);
9595

96+
# For non haskell dependencies (and `pre-existing` haskell packages)
97+
# we want to search all the configs.
98+
allConfigs = selectedConfigs ++
99+
builtins.map (x: (haskellLib.dependToLib x).config) additionalPackages;
100+
96101
# Add the system libraries and build tools of the selected haskell packages to the shell.
97102
# We need to remove any inputs which are selected components (see above).
98103
# `buildInputs`, `propagatedBuildInputs`, and `executableToolDepends` contain component
@@ -115,10 +120,13 @@ let
115120
# Set up a "dummy" component to use with ghcForComponent.
116121
component = {
117122
depends = packageInputs;
118-
pre-existing = lib.concatMap (x: (haskellLib.dependToLib x).config.pre-existing or []) packageInputs;
119-
libs = lib.concatMap (x: (haskellLib.dependToLib x).config.libs or []) packageInputs;
120-
pkgconfig = lib.concatMap (x: (haskellLib.dependToLib x).config.pkgconfig or []) packageInputs;
121-
frameworks = lib.concatMap (x: (haskellLib.dependToLib x).config.frameworks or []) packageInputs;
123+
pre-existing =
124+
if exactDeps
125+
then lib.unique (lib.concatMap (x: (haskellLib.dependToLib x).pre-existing or []) allConfigs)
126+
else haskell-nix.ghc-pre-existing ghc;
127+
libs = haskellLib.uniqueWithName (lib.concatMap (x: (haskellLib.dependToLib x).libs or []) allConfigs);
128+
pkgconfig = haskellLib.uniqueWithName (lib.concatMap (x: (haskellLib.dependToLib x).pkgconfig or []) allConfigs);
129+
frameworks = haskellLib.uniqueWithName (lib.concatMap (x: (haskellLib.dependToLib x).frameworks or []) allConfigs);
122130
doExactConfig = false;
123131
};
124132
configFiles = makeConfigFiles {

0 commit comments

Comments
 (0)