Skip to content

Commit

Permalink
Merge pull request #4 from axonasif/axonasif/persist_files
Browse files Browse the repository at this point in the history
Persist $HOME contents by overlaying /workspace, for Haskell toolchain
  • Loading branch information
complyue authored Jun 4, 2024
2 parents 2915070 + 79a3a81 commit 42aa911
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 21 deletions.
30 changes: 17 additions & 13 deletions .gitpod.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
FROM gitpod/workspace-full:latest
# Image source code: https://github.com/axonasif/workspace-images/tree/tmp
# Also see https://github.com/gitpod-io/workspace-images/issues/1071
FROM axonasif/workspace-base@sha256:8c057b1d13bdfe8c279c68aef8242d32110c8d5310f9a393f9c0417bc61367d9

USER gitpod

# Persist ~ due to the requirements of this project
RUN echo 'create-overlay $HOME' > "$HOME/.runonce/1-home_persist"

# or git will keep prompting
RUN git config --global pull.ff only

# ~/.stack, ~/.ghcup will be lost across Gitpod workspace restarts,
# use /workspace/ so it is persisted as part of prebuilt workspace
ENV STACK_ROOT=/workspace/.stack
ENV GHCUP_INSTALL_BASE_PREFIX=/workspace

# Add ghcup to path
ENV PATH=/workspace/bin:/workspace/.ghcup/bin:${PATH}

# create toolhome
RUN mkdir -p /workspace/bin
# add /workspace/bin and ghcup to PATH
ENV PATH="/workspace/bin:$HOME/.ghcup/bin:$PATH"

# install ghcup, then stack and hls via it
RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | env BOOTSTRAP_HASKELL_NONINTERACTIVE=1 sh
RUN ghcup install stack
RUN ghcup install hls
RUN ghcup install stack && \
ghcup install hls
# populate stack's cache, this takes minutes & GBs
RUN stack update

# install latest epm
RUN mkdir -p $HOME/.local/bin; \
curl -o $HOME/.local/bin/epm -L https://github.com/e-wrks/epm/raw/latest/epm && \
chmod +x $HOME/.local/bin/epm
12 changes: 6 additions & 6 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
image:
file: .gitpod.Dockerfile

workspaceLocation: tour/main.code-workspace # Relative to /workspace dir

ports:
- port: 1024-6000
onOpen: ignore

tasks:
- name: Build Đ Tooling
init: |
# /workspace/bin should have been created per Dockerfile, and added to $PATH
curl -o /workspace/bin/epm -L https://github.com/e-wrks/epm/raw/latest/epm
chmod a+x /workspace/bin/epm
# update epm to latest version
curl -o $HOME/.local/bin/epm -L https://github.com/e-wrks/epm/raw/latest/epm
# prepare /workspace as an epm home
cd /workspace
epm init \
Expand All @@ -19,17 +20,16 @@ tasks:
-B http://github.com/complyue \
nedh els sedh eas hasdim haskit
cd /workspace/edh-universe
# build & install executables from Edh packages
# build & install executables from Edh packages,
# this takes minutes & GBs
stack update
stack install
command: |
# update packages in root epm home
cd /workspace/edh-universe
epm up
epm i
epm x gen-hie > hie.yaml
# update executables from Edh packages
stack update
stack install
vscode:
Expand Down
2 changes: 0 additions & 2 deletions .rebuild-gitpod

This file was deleted.

12 changes: 12 additions & 0 deletions main.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
// All paths are relative to your main repo
// The additional repos are cloned inside /workspace dir
"folders": [
{
"path": "." // Main repo that you will open in Gitpod (e.g. frontend)
},
{
"path": "/workspace/edh-universe" // Additional repo
}
]
}

0 comments on commit 42aa911

Please sign in to comment.