Skip to content

Commit

Permalink
add gitpod and devcontainer configs based on mathlib4
Browse files Browse the repository at this point in the history
  • Loading branch information
m4lvin committed Oct 25, 2023
1 parent 1548acd commit 6efd9ed
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM mcr.microsoft.com/devcontainers/base:jammy

USER vscode
WORKDIR /home/vscode

RUN curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- -y --default-toolchain none

ENV PATH="/home/vscode/.elan/bin:${PATH}"
15 changes: 15 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "lean4-pdl dev container",

"build": {
"dockerfile": "Dockerfile"
},

"onCreateCommand": "lake exe cache get!",

"customizations": {
"vscode" : {
"extensions" : [ "leanprover.lean4" ]
}
}
}
37 changes: 37 additions & 0 deletions .docker/gitpod/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This is the Dockerfile for `leanprovercommunity/mathlib:gitpod`.

# gitpod doesn't support multiple FROM statements, (or rather, you can't copy from one to another)
# so we just install everything in one go
FROM ubuntu:jammy

USER root

RUN apt-get update && apt-get install sudo git curl git bash-completion python3 python3-requests -y && apt-get clean

RUN useradd -l -u 33333 -G sudo -md /home/gitpod -s /bin/bash -p gitpod gitpod \
# passwordless sudo for users in the 'sudo' group
&& sed -i.bkp -e 's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL/g' /etc/sudoers
USER gitpod
WORKDIR /home/gitpod

SHELL ["/bin/bash", "-c"]

# gitpod bash prompt
RUN { echo && echo "PS1='\[\033[01;32m\]\u\[\033[00m\] \[\033[01;34m\]\w\[\033[00m\]\$(__git_ps1 \" (%s)\") $ '" ; } >> .bashrc

# install elan
RUN curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- -y --default-toolchain none

# install whichever toolchain we are currently using
RUN . ~/.profile && elan toolchain install $(curl https://raw.githubusercontent.com/m4lvin/lean4-pdl/main/lean-toolchain)

ENV PATH="/home/gitpod/.local/bin:/home/gitpod/.elan/bin:${PATH}"

# fix the infoview when the container is used on gitpod:
ENV VSCODE_API_VERSION="1.50.0"

# ssh to github once to bypass the unknown fingerprint warning
RUN ssh -o StrictHostKeyChecking=no github.com || true

# run sudo once to suppress usage info
RUN sudo echo finished
9 changes: 9 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
image:
file: .docker/gitpod/Dockerfile

vscode:
extensions:
- leanprover.lean4

tasks:
- init: lake exe cache get
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# PDL in Lean 4

[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/m4lvin/lean4-pdl?quickstart=1)

Some day this will hopefully replace <https://github.com/m4lvin/tablean>.

0 comments on commit 6efd9ed

Please sign in to comment.