Skip to content

Commit 2a90a65

Browse files
authored
Merge branch 'master' into angerman/fix-aarch64-musl
2 parents ac6100c + c116ed4 commit 2a90a65

File tree

261 files changed

+41837
-397
lines changed

Some content is hidden

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

261 files changed

+41837
-397
lines changed

.github/workflows/publish.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: "Publish a flake to flakestry"
2+
on:
3+
push:
4+
tags:
5+
- "v?[0-9]+.[0-9]+.[0-9]+"
6+
- "v?[0-9]+.[0-9]+"
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: "The existing tag to publish"
11+
type: "string"
12+
required: true
13+
jobs:
14+
publish-flake:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
id-token: "write"
18+
contents: "read"
19+
steps:
20+
- uses: flakestry/flakestry-publish@main
21+
with:
22+
version: "${{ inputs.tag || github.ref_name }}"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ The troubleshooting documentation also contains some help for other common issue
2525
The `haskell.nix` repository contains the runtime system for building
2626
Haskell packages in Nix. It depends on other repos, which are:
2727

28-
- [`nix-tools`](https://github.com/input-output-hk/nix-tools) — provides the programs for generating Nix expressions from Haskell projects.
29-
3028
- [`hackage.nix`](https://github.com/input-output-hk/hackage.nix) — the latest contents of the [Hackage](https://hackage.haskell.org/) databases, converted to Nix expressions.
3129

3230
- [`stackage.nix`](https://github.com/input-output-hk/stackage.nix) — all of the [Stackage](https://www.stackage.org/) snapshots, converted to Nix expressions.
3331

32+
> [!NOTE]
33+
> For commercial support, please don't hesitate to reach out at [email protected]

build.nix

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ let
2020
haskell = pkgs.haskell-nix;
2121
buildHaskell = pkgs.buildPackages.haskell-nix;
2222
tool = buildHaskell.tool;
23+
ghcFromTo = from: to: __compareVersions haskell.compiler.${compiler-nix-name}.version from >= 0 && __compareVersions haskell.compiler.${compiler-nix-name}.version to < 0;
2324
in rec {
2425
tests = import ./test/default.nix { inherit pkgs evalPackages ifdLevel compiler-nix-name; };
2526

@@ -41,55 +42,26 @@ in rec {
4142
"ghc8105" = "3.4.1";
4243
"ghc8106" = "3.4.1";
4344
"ghc8107" = "3.4.1";
45+
"ghc928" = "3.6.1";
4446
}.${compiler-nix-name} or "latest";
4547
};
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) {
48+
} // pkgs.lib.optionalAttrs (ghcFromTo "9.2" "9.6") {
4949
stack =
5050
tool compiler-nix-name "stack" {
5151
version = "2.11.1";
5252
inherit evalPackages;
5353
};
54-
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.0" < 0) {
54+
} // pkgs.lib.optionalAttrs (ghcFromTo "8.10.7" "9.0") {
5555
# This version will build for ghc < 9.8, but we are only going to test it for
5656
# ghc < 9.0 (since newer versions do not work with ghc 8.10.7).
5757
"hls-22" = tool compiler-nix-name "haskell-language-server" {
5858
inherit evalPackages;
5959
src = pkgs.haskell-nix.sources."hls-2.2";
6060
};
61-
} // pkgs.lib.optionalAttrs (
62-
__compareVersions haskell.compiler.${compiler-nix-name}.version "9.0" >= 0 &&
63-
__compareVersions haskell.compiler.${compiler-nix-name}.version "9.8" < 0
64-
) {
65-
"hls-23" = tool compiler-nix-name "haskell-language-server" {
61+
} // pkgs.lib.optionalAttrs (ghcFromTo "9.0" "9.8") {
62+
"hls-26" = tool compiler-nix-name "haskell-language-server" {
6663
inherit evalPackages;
67-
src = pkgs.haskell-nix.sources."hls-2.3";
68-
};
69-
} // pkgs.lib.optionalAttrs (
70-
__compareVersions haskell.compiler.${compiler-nix-name}.version "9.0" >= 0 &&
71-
__compareVersions haskell.compiler.${compiler-nix-name}.version "9.9" < 0
72-
) {
73-
"hls-24" = tool compiler-nix-name "haskell-language-server" {
74-
inherit evalPackages;
75-
src = pkgs.haskell-nix.sources."hls-2.4";
76-
# Even though this is in the cabal.project it is inside a condional
77-
# and so haskell.nix cannot parse it properly. Luckily adding it
78-
# again seems to work fine.
79-
cabalProjectLocal = ''
80-
repository head.hackage.ghc.haskell.org
81-
url: https://ghc.gitlab.haskell.org/head.hackage/
82-
secure: True
83-
key-threshold: 3
84-
root-keys:
85-
f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89
86-
26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329
87-
7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d
88-
--sha256: sha256-aVI93DtHziicNn2mGli0YE+bC5BeT7mOQQETp2Thi68=
89-
90-
if impl(ghc < 9.7)
91-
active-repositories: hackage.haskell.org
92-
'';
64+
src = pkgs.haskell-nix.sources."hls-2.6";
9365
};
9466
})
9567
);

compiler/ghc/default.nix

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,12 @@ let
316316
# fall back to non-dynamic. We only have x86_64 dynamic linker with musl.
317317
+ lib.optionalString (targetPlatform.isAndroid || (targetPlatform.isMusl && !targetPlatform.isx86))
318318
" '*.ghc.cabal.configure.opts += --flags=-dynamic-system-linker'"
319+
# PIC breaks GHC annotations on windows (see test/annotations for a test case)
320+
+ lib.optionalString (enableRelocatedStaticLibs && !targetPlatform.isWindows)
321+
" '*.*.ghc.*.opts += -fPIC' '*.*.cc.*.opts += -fPIC'"
322+
# `-fexternal-dynamic-refs` causes `undefined reference` errors when building GHC cross compiler for windows
323+
+ lib.optionalString (enableRelocatedStaticLibs && targetPlatform.isx86_64 && !targetPlatform.isWindows)
324+
" '*.*.ghc.*.opts += -fexternal-dynamic-refs'"
319325
# The following is required if we build on aarch64-darwin for aarch64-iOS. Otherwise older
320326
# iPhones/iPads/... won't understand the compiled code, as the compiler will emit LDSETALH
321327
# + lib.optionalString (targetPlatform.???) "'*.rts.ghc.c.opts += -optc-mcpu=apple-a7 -optc-march=armv8-a+norcpc'"
@@ -792,6 +798,19 @@ stdenv.mkDerivation (rec {
792798
then ''
793799
mkdir $out
794800
cp -r _build/stage1/bin $out
801+
${
802+
# These are needed when building the reinstallable lib ghc
803+
if targetPlatform.isMusl
804+
then ''
805+
cp _build/stageBoot/bin/genprimopcode $out/bin
806+
cp _build/stageBoot/bin/deriveConstants $out/bin
807+
'' else ''
808+
cp _build/stageBoot/bin/${targetPrefix}genprimopcode $out/bin
809+
ln -s $out/bin/${targetPrefix}genprimopcode $out/bin/genprimopcode
810+
cp _build/stageBoot/bin/${targetPrefix}deriveConstants $out/bin
811+
ln -s $out/bin/${targetPrefix}deriveConstants $out/bin/deriveConstants
812+
''
813+
}
795814
cp -r _build/stage1/lib $out
796815
mkdir $doc
797816
cp -r _build/stage1/share $doc

docs/SUMMARY.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
- [Tutorials](./tutorials/index.md)
55
- [Creating a development environment](./tutorials/development.md)
66
- [Getting started](./tutorials/getting-started.md)
7-
- [Getting started with Flakes](./tutorials/getting-started-flakes.md)
8-
- [Getting started with Hix](./tutorials/getting-started-hix.md)
97
- [Sourcing files only part of git repository using cleanGit](./tutorials/clean-git.md)
108
- [Handling git repositories in projects](./tutorials/source-repository-hashes.md)
119
- [Mapping non-Haskell dependencies to Nixpkgs](./tutorials/pkg-map.md)

docs/tutorials/getting-started-flakes.md

Lines changed: 0 additions & 133 deletions
This file was deleted.

docs/tutorials/getting-started-hix.md

Lines changed: 0 additions & 87 deletions
This file was deleted.

0 commit comments

Comments
 (0)