aboutsummaryrefslogtreecommitdiff
path: root/bwrap-files
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2024-09-16 09:49:37 +0200
committerTom Smeding <tom@tomsmeding.com>2024-09-16 09:49:37 +0200
commit488b6bfdd505508527b26f171f966245fc32cf1f (patch)
tree9aa2c6d20745409aa2f727926facd7c7b8068167 /bwrap-files
parent1ed636f013cad12ab74f5fcd264280d7504ab951 (diff)
Pick latest GHC if availableHEADmaster
Diffstat (limited to 'bwrap-files')
-rwxr-xr-xbwrap-files/start.sh1
-rwxr-xr-xbwrap-files/workdir/entry.sh11
2 files changed, 11 insertions, 1 deletions
diff --git a/bwrap-files/start.sh b/bwrap-files/start.sh
index 08f3d7e..4eb049d 100755
--- a/bwrap-files/start.sh
+++ b/bwrap-files/start.sh
@@ -28,6 +28,7 @@ args=(
--setenv PATH "/bin:/usr/bin:${ghcup_base}/bin"
--setenv GHCUP_INSTALL_BASE_PREFIX "$(dirname "${ghcup_base}")"
--proc /proc
+ --dev-bind /dev/null /dev/null
--chdir "/workdir"
--new-session
--unshare-all
diff --git a/bwrap-files/workdir/entry.sh b/bwrap-files/workdir/entry.sh
index 1a466da..ce66a8d 100755
--- a/bwrap-files/workdir/entry.sh
+++ b/bwrap-files/workdir/entry.sh
@@ -3,4 +3,13 @@ set -euo pipefail
cd "$(dirname "$0")"
-ghcup --offline run -- ghci Yahb2Defs.hs 2>&1
+ver=$(ghcup --offline list -t ghc -c installed -r 2>/dev/null | sed -n '/latest/ s/^ghc \([^ ]*\).*/\1/p')
+if [[ -n $ver ]]; then
+ versionargs=( --ghc "$ver" ) # if we can get "latest", take that
+else
+ versionargs=() # just fall back to the currently "set" version
+fi
+
+ghcup --offline run "${versionargs[@]}" -- ghci Yahb2Defs.hs 2>&1
+
+# vim: set sw=2 ts=8 et: