Skip to content

Commit ec5bd9e

Browse files
Add Nim to extra.
1 parent 7509426 commit ec5bd9e

File tree

6 files changed

+36
-0
lines changed

6 files changed

+36
-0
lines changed

extra/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ RUN apt-get update && \
1010
scipy && \
1111
rm -rf /var/lib/apt/lists/*
1212

13+
COPY ./bin/update/nim /update/
14+
RUN set -xe && \
15+
apt-get update && \
16+
apt-get install -y --no-install-recommends cron && \
17+
/update/nim && \
18+
echo "0 0 * * * /update/nim &> /var/log/nim.log" | crontab - && \
19+
rm -rf /var/lib/apt/lists/*
20+
1321
COPY docker-entrypoint.sh /
1422
ENTRYPOINT ["/docker-entrypoint.sh"]
1523

extra/bin/update/nim

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
nimDir=/usr/local/nim
3+
nim=$nimDir/bin/nim
4+
5+
stable_version=`curl -fSsL https://nim-lang.org/channels/stable`
6+
[[ -f $nim ]] && current_version=`$nim -v | head -n 1 | awk '{ print $4 }'`
7+
8+
echo "Current version: $current_version"
9+
echo "Latest stable version: $stable_version"
10+
11+
if [[ $stable_version != $current_version ]]; then
12+
echo "Updating Nim to latest stable version."
13+
curl -fSsL "https://nim-lang.org/download/nim-$stable_version-linux_x64.tar.xz" -o /tmp/nim.tar.xf
14+
rm -rf $nimDir
15+
mkdir $nimDir
16+
tar -xf /tmp/nim.tar.xf -C $nimDir --strip-components=1
17+
chmod +x $nim
18+
rm /tmp/nim.tar.xf
19+
else
20+
echo "Nim is already up to date."
21+
fi

extra/tests/nim/lang.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
VERSIONS="stable"
2+
NAME="Nim ($VERSION)"
3+
SOURCE_FILE="main.nim"
4+
BINARY_FILE="main"
5+
COMPILE_CMD="/usr/local/nim/bin/nim compile --nimcache:.cache/nim $ARGS $SOURCE_FILE"
6+
RUN_CMD="./$BINARY_FILE"

extra/tests/nim/main.nim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
echo "hello, world"
File renamed without changes.

0 commit comments

Comments
 (0)