Skip to content

Commit

Permalink
make ghcup install available everywhere
Browse files Browse the repository at this point in the history
Signed-off-by: Gerwin Klein <[email protected]>
  • Loading branch information
lsf37 committed May 13, 2024
1 parent c15a0af commit c0daf48
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 0 additions & 2 deletions dockerfiles/l4v.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,3 @@ RUN /bin/bash /tmp/l4v.sh \
&& apt-get clean autoclean \
&& apt-get autoremove --purge --yes \
&& rm -rf /var/lib/apt/lists/*

ENV PATH "${PATH}:/opt/mlton/bin"
1 change: 1 addition & 0 deletions scripts/camkes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_H

# shellcheck disable=SC1091
source "$GHCUP_INSTALL_BASE_PREFIX/.ghcup/env"
echo "export GHCUP_INSTALL_BASE_PREFIX=/opt/ghcup" >> "$HOME/.bashrc"
echo "source $GHCUP_INSTALL_BASE_PREFIX/.ghcup/env" >> "$HOME/.bashrc"

as_root rm -f "$GHCUP_INSTALL_BASE_PREFIX"/.ghcup/cache/*
Expand Down
3 changes: 3 additions & 0 deletions scripts/l4v.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

set -exuo pipefail

# make sure PATH etc is set up
source "$HOME/.bashrc"

# Source common functions
DIR="${BASH_SOURCE%/*}"
test -d "$DIR" || DIR=$PWD
Expand Down
6 changes: 6 additions & 0 deletions scripts/utils/user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,13 @@ grep "export" /root/.bashrc >> "/home/${UNAME}/.bashrc"
# Note that this block does not do parameter expansion, so will be
# copied verbatim into the user's .bashrc.
# We use this to ensure they have the repo program in their path,
# that they pick up any potentially present Haskell installation,
# and to ensure they start in the /host dir (aka, their own file
# path)
cat << 'EOF' >> "/home/${UNAME}/.bashrc"
export PATH=/scripts/repo:$PATH
export GHCUP_INSTALL_BASE_PREFIX=/opt/ghcup
[ -r /opt/ghcup/.ghcup/env ] && source /opt/ghcup/.ghcup/env
cd /host
EOF

Expand All @@ -128,6 +131,9 @@ chown -R "$chown_setting" /isabelle
# Isabelle expects a home dir folder.
ln -s /isabelle "/home/${UNAME}/.isabelle"

# Make Haskell installation writable if it exists
[ -d /opt/ghcup ] && chown -R "${UNAME}" /opt/ghcup

# Make sure the user owns their home dir
chown -R "$chown_setting" "/home/${UNAME}"
chmod -R ug+rw "/home/${UNAME}"

0 comments on commit c0daf48

Please sign in to comment.