-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Dev Container Configuration Files #9039
Conversation
I tried to be minimally invasive, i.e.
I hope this is fine and the instructions in the additional @jgm What do you think? Any objections? Or additions? There are currently four configurations available: P.S.: Tags latest and recommended come from https://www.haskell.org/ghcup/install/#supported-tools |
Well, well, well... Somehow, statically linking does not work with GitHub Codespaces (
|
How do I do that? I've never used Codespaces. It wasn't obvious from the link. My main concern about this is that it's a lot of code that would need to be updated periodically, e.g. with ghc changes. Does it need to be in the pandoc repository itself? |
https://docs.github.com/en/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository#creating-a-codespace-for-a-repository ff should explain.
The default config ( For the other configs we could agree on updating 'once a week' / 'every two weeks' / 'once a month'. Stack does not update that frequently. It is a different story with the Haskell Language Server, though.
AFAIK Yes. |
In order for this to work, I must keep the GHC musl Container Registry up to date. For example: There was a new HLS release yesterday. This means I am going to trigger a build for HLS v2.2.0.0 for each Dev Container's GHC versions asap. |
Does it add any value to Pandoc itself: No. @jgm am absolutely fine if you do not want to add Dev Containers to the |
I'm leaning against adding this just because the maintenance burden is nontrivial. But I'll leave this open; others may want to comment. |
This would be an interesting addition for people using tablet devices like iPads for doing actual work. However, due to the somewhat messy configuration (at least to me) regarding spending limits and who will pay for what when, this could easily produce unwanted costs ... |
Dev Container configurations (
👉 Updating the default config's The That is it for now. Let us keep this a draft, then. There will soon be an official, statically linked binary release of Stack for both Footnotes
|
d477594
to
0581dbd
Compare
FYI I downgraded package pkgconf to v1.8.1 in all Due to haskell/cabal#8923 |
fdabfb7
to
47f0733
Compare
@jgm Reorganise files = Point from # Dev Containers
Pandoc's Dev Containers provide the following tools:
- The
[Haskell Toolchain](https://www.haskell.org/ghcup/install/#supported-tools)
([GHC](https://www.haskell.org/ghc),
[Cabal](https://cabal.readthedocs.io),
[Stack](https://docs.haskellstack.org), and
[HLS](https://haskell-language-server.readthedocs.io))
- [Git](https://git-scm.com)
- [HLint](https://hackage.haskell.org/package/hlint)
- [yamllint](https://yamllint.readthedocs.io)
- [ShellCheck](https://www.shellcheck.net)
- [hadolint](https://github.com/hadolint/hadolint)
The tools in the Haskell Toolchain are installed at `/usr/local/bin`<sup>[1](#path),[2](#alt-path)</sup>.
| :information_source: Executables installed with Cabal (at `$HOME/.cabal/bin` or `$HOME/.local/bin`) or Stack or Pip (at `$HOME/.local/bin`)<br>take precedence over the same executable installed at `/usr/local/sbin`, `/usr/local/bin`, etc.|
|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
[VS Code](https://code.visualstudio.com) is used as IDE, with the following
extensions pre‑installed:
- [Haskell](https://marketplace.visualstudio.com/items?itemName=haskell.haskell)
- [GitHub Pull Requests and Issues](https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-pull-request-github)
- [GitLens — Git supercharged](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens)
- Pinned to v11.7.0 due to unsolicited AI content in recent versions.
- [Git Graph](https://marketplace.visualstudio.com/items?itemName=mhutchie.git-graph)
- [ShellCheck](https://marketplace.visualstudio.com/items?itemName=timonwong.shellcheck)
- [hadolint](https://marketplace.visualstudio.com/items?itemName=exiasr.hadolint)
- [EditorConfig](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig)
- [Resource Monitor](https://marketplace.visualstudio.com/items?itemName=mutantdino.resourcemonitor)
## Parent images
Pandoc's Dev Containers are derived from the same docker images used to build
the *statically linked* Linux amd64 and arm64 binary releases of pandoc
itself.
The parent images are multi‑arch (`linux/amd64`, `linux/arm64/v8`)
<nobr>*GHC musl*</nobr> images. They are based on Alpine Linux (that is
[musl libc](https://musl.libc.org) and [BusyBox](https://www.busybox.net)).
They contain *unofficial* binary distributions of GHC (that is, ones not
released by the GHC developers). That is because:
1. the official GHC binary distributions for Alpine Linux/x86_64 have known
bugs; and
1. there are no official binary distributions for Alpine Linux/AArch64.
Stack's global configuration (`/etc/stack/config.yaml`) sets
<nobr>`system-ghc: true`</nobr> and <nobr>`install-ghc: false`</nobr>. That
ensures that only the GHC available in the Dev Containers is used.
## Usage
For local/remote usage with VS Code, please follow the instructions at
[Developing inside a Container](https://code.visualstudio.com/docs/devcontainers/containers).
For use with Github Codespaces, please follow the instruction at
[Creating a codespace for a repository](https://docs.github.com/en/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository#creating-a-codespace-for-a-repository).
### Persistence
Data in the following locations is persisted:
1. The user's home directory (`/home/vscode`<sup>[3](#home)</sup>)
1. The Dev Container's workspace (`/workspaces`)
This is accomplished either via a *volume* or *bind mount* (or *loop device*
on Codespaces) and is preconfigured.
| :information_source: **Codespaces: A 'Full Rebuild Container' resets the home directory!**<br>This is never necessary unless you want exactly that. |
|:----------------------------------------------------------------------------------------------------------------------------------------------------|
## Install pandoc
### Using cabal
Addendum to [Installing pandoc > Compiling from source > Quick cabal method](https://github.com/jgm/pandoc/blob/main/INSTALL.md#quick-cabal-method):
Use
<nobr>
`cabal build --enable-executable-static --ghc-options '-optl-pthread' pandoc-cli`
</nobr> to
build a *statically linked* `pandoc` executable that can run on any Linux
machine of the same architecture.
### Using stack
See [Installing pandoc > Compiling from source > Quick stack method](https://github.com/jgm/pandoc/blob/main/INSTALL.md#quick-stack-method).
You may try
<nobr>
`stack build --ghc-options '-static -optl-static -optl-pthread' pandoc-cli`
<sup>[4](#bug)</sup>.
</nobr> to
build a *statically linked* `pandoc` executable.
:information_source: This works on Alpine Linux/AArch64 but not x86_64.
## Haskell Language Server (HLS)
Choose <nobr>`Manually via PATH`</nobr> when asked the following question:
<img width="520" alt="Manage HLS" src="https://github.com/jgm/pandoc/assets/20233085/8d054f29-299d-4b7f-b7db-3287cafe1587">
---
<a name="path">1</a>: `PATH=$HOME/.cabal/bin:$HOME/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin`
<a name="alt-path">2</a>: Installed at `/usr/bin` for GHC versions 9.2.x.
<a name="home">3</a>: Alternatively for the root user (`/root`). Use with
Docker/Podman in *rootless mode*.
<a name="bug">4</a>: `--enable-executable-static --ghc-options '-optl-pthread'`
is supposed to be equivalent to
`--ghc-options '-static -optl-static -optl-pthread'`. But somehow it is not. |
eba80f0
to
4ebdaae
Compare
@jgm I could reduce to the default Dev Container. The one that is supposed to work with the Stack is providing just two Dev Containers: For Cross reference: commercialhaskell/stack#6228 |
- Update HLS to v2.4.0.0
- Update Stack to v2.11.1 - Keep GHC 9.2 as recommended - haskell/ghcup-hs@2c3148a is inconsistent
Closed due to lack of interest. |
Have you been able to compile pandoc with ghc 9.8.1? |
Yes. |
Did you need special cabal flags? When I tried, it didn't seem that all the dependencies had compatible bounds. |
$ docker run --rm -ti glcr.b-data.ch/ghc/ghc-musl:9.8.1 bash
605357ef37ca:/# git clone https://github.com/jgm/pandoc.git
Cloning into 'pandoc'...
remote: Enumerating objects: 123440, done.
remote: Counting objects: 100% (168/168), done.
remote: Compressing objects: 100% (119/119), done.
remote: Total 123440 (delta 57), reused 99 (delta 33), pack-reused 123272
Receiving objects: 100% (123440/123440), 59.78 MiB | 15.93 MiB/s, done.
Resolving deltas: 100% (78660/78660), done.
605357ef37ca:/# cd pandoc
605357ef37ca:/pandoc# cabal update
Config file path source is default config file.
Config file not found: /root/.config/cabal/config
Writing default configuration to /root/.config/cabal/config
Cloning into '/pandoc/dist-newstyle/src/typst-hs-659aa3821678255'...
remote: Enumerating objects: 5591, done.
remote: Counting objects: 100% (409/409), done.
remote: Compressing objects: 100% (173/173), done.
remote: Total 5591 (delta 243), reused 388 (delta 228), pack-reused 5182
Receiving objects: 100% (5591/5591), 7.12 MiB | 14.24 MiB/s, done.
Resolving deltas: 100% (3957/3957), done.
HEAD is now at 71c2494 Further improvements in parsing attachments.
Downloading the latest package list from hackage.haskell.org
Package list of hackage.haskell.org has been updated.
The index-state is set to 2023-11-18T06:48:16Z.
605357ef37ca:/pandoc# cabal build --allow-newer --enable-executable-static --ghc-options '-optl-pthread' pandoc-cli 605357ef37ca:/pandoc# file dist-newstyle/build/x86_64-linux/ghc-9.8.1/pandoc-cli-0.1.1.1/x/pandoc/build/pandoc/pandoc
dist-newstyle/build/x86_64-linux/ghc-9.8.1/pandoc-cli-0.1.1.1/x/pandoc/build/pandoc/pandoc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, with debug_info, not stripped |
@jgm You may test online with GitHub Codespaces at https://github.com/benz0li/pandoc/tree/add-dev-containers
See also https://docs.github.com/en/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository#creating-a-codespace-for-a-repository
Screenshot using the default configuration: