Skip to content

Commit

Permalink
Update stackage resolver to LTS 21.6 (#2275)
Browse files Browse the repository at this point in the history
Stack LTS 21.6 uses GHC 9.4.5, binaries for HLS are available via ghcup.

Changes required:

1. Fix warnings about type level `:` and `[]` used without backticks.
2. Fix warnings about deprecation of builtin `~` - replaced with `import
Data.Type.Equality ( type (~) )` in the Prelude
3. SemVer is no longer a monoid
4. `path-io` now contains the `AnyPath` instances we were defining
(thanks to Jan) so they can be removed.
5. Added `aeson-better-errors-0.9.1.1` as an extra-dep. The reason it is
not part of the resolver is only because it has a strict bound on base
which is not compatible with ghc 9.4.5. To work around this I've set:

    ```
    allow-newer: true
    allow-newer-deps:
      - aeson-better-errors
    ```
which relaxed the upper constraint bounds for `aeson-better-errors`
only. When the base constraints have been updated we can remove this
workaround.

6. Use stack2cabal to generate the cabal.project file and to freeze
dependency versions.

    https://www.stackage.org/lts-21.6/cabal.config now contains the
constraint `haskeline installed`, which means that the version of
haskeline that is globally installed with GHC 9.4.5 will be used, see:
    * commercialhaskell/stackage#7002
GHC 9.4.5 comes with haskeline 0.8.2 preinstalled but our configuration
contains the source-repository-package for haskeline 0.8.2.1 (required
because we're using a fork) so if you try to run` cabal build` you get a
conflict.

Constraints from cabal imports cannot yet be overridden so it's not
possible to get rid of this conflict using the import method. So we need
to use stack2cabal with an explicit freeze file instead.

7. Remove `runTempFilePure` as this is unused and depends on
`Polysemy.Fresh` in `polysemy-zoo` which is not available in the
resolver. It turns out that it's not possible to use the `Fresh` effect
in a pure context anyway, so it was not possible to use
`runTempFilePure` for its original purpose.

8. We now use https://github.com/benz0li/ghc-musl as the base container
for static linux builds, this means we don't need to maintain our own
Docker container for this purpose.

9. The PR for the nightly builds is ready
anoma/juvix-nightly-builds#2, it should be
merged as soon as this PR is merged.

Thanks to @benz0li for maintaining https://github.com/benz0li/ghc-musl
and (along with @TravisCardwell) for help with building the static
binary.

* Closes #2166
  • Loading branch information
paulcadman committed Aug 11, 2023
1 parent b5a3b00 commit 46ab163
Show file tree
Hide file tree
Showing 31 changed files with 3,105 additions and 241 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ ARG VARIANT="ubuntu-22.04"
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}
ENV DEBIAN_FRONTEND=noninteractive
ENV BOOTSTRAP_HASKELL_NONINTERACTIVE=1
ENV BOOTSTRAP_HASKELL_GHC_VERSION=9.2.7
ENV BOOTSTRAP_HASKELL_GHC_VERSION=9.4.5
ENV BOOTSTRAP_HASKELL_CABAL_VERSION=3.10.1.0
ENV BOOTSTRAP_HASKELL_STACK_VERSION=2.9.3
ENV BOOTSTRAP_HASKELL_STACK_VERSION=2.11.1
ENV BOOTSTRAP_HASKELL_INSTALL_STACK=1
ENV BOOTSTRAP_HASKELL_INSTALL_HLS=1

Expand Down
18 changes: 15 additions & 3 deletions .github/workflows/linux-static-binary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ on:
required: true
default: "main"

env:
STACK_VERSION: 2.11.1

jobs:
build:
name: Build static binary
runs-on: ubuntu-latest
container: ghcr.io/paulcadman/ghc-alpine:9.2.7
container: glcr.b-data.ch/ghc/ghc-musl:9.4.5
steps:
- name: checkout code
uses: actions/checkout@v3
Expand All @@ -28,14 +31,23 @@ jobs:
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
shell: bash

- name: install stack
run: |
curl https://github.com/commercialhaskell/stack/releases/download/v$STACK_VERSION/stack-$STACK_VERSION-linux-x86_64-static.tar.gz -OL
tar xf stack-STACK_VERSION-linux-x86_64-static.tar.gz
cp stack-STACK_VERSION-linux-x86_64-static/stack /usr/local/bin
- name: Stack permissions bug workaround
run: "chown -R $(id -un):$(id -gn) ~"

- name: Install clang14
run: apk add --update clang14

- name: Runtime build
run: make runtime
run: make runtime LIBTOOL=llvm14-ar

- name: build Juvix
run: stack install --allow-different-user --system-ghc --ghc-options='-split-sections -optl-static'
run: stack install --allow-different-user --system-ghc --ghc-options='-split-sections' --flag juvix:static

- run: echo "HOME=$HOME" >> $GITHUB_ENV
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion app/Commands/Init.hs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ getVersion :: forall r. (Members '[Embed IO] r) => Sem r SemVer
getVersion = do
txt <- embed getLine
if
| Text.null txt -> return mempty
| Text.null txt -> return defaultVersion
| otherwise -> case parse semver' txt of
Right r -> return r
Left err -> do
Expand Down
27 changes: 12 additions & 15 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
with-compiler: ghc-9.2.7
-- Generated by stack2cabal

with-compiler: ghc-9.4.5

packages:
./

jobs: $ncpus
source-repository-package
type: git
location: https://github.com/janmasrovira/haskeline.git
tag: 81e393e156508a20fcc197acc945b0f44aa4f82b

source-repository-package
type: git
location: https://github.com/janmasrovira/repline.git
tag: a735ab1459db408adda080eb5ea21b96fb4a6011

allow-older: *
allow-newer: *

import: https://www.stackage.org/lts-20.21/cabal.config

package juvix
ghc-options: -optP-Wno-nonportable-include-path
test-show-details: direct

source-repository-package
type: git
location: https://github.com/janmasrovira/repline.git
tag: a735ab1459db408adda080eb5ea21b96fb4a6011

source-repository-package
type: git
location: https://github.com/janmasrovira/haskeline.git
tag: 81e393e156508a20fcc197acc945b0f44aa4f82b
Loading

0 comments on commit 46ab163

Please sign in to comment.