Skip to content

Commit 47bd62e

Browse files
committed
cumulative changes
1 parent 7eb4b97 commit 47bd62e

File tree

2 files changed

+37
-4
lines changed

2 files changed

+37
-4
lines changed

inception.sh

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
# Errors in this script are critical
4+
set -euo pipefail
5+
6+
if [[ "$(hostname)" == "sms" ]] && [ -d /tmp/nyx/sandbox ]; then
7+
echo 'TO RUN INSIDE CONTROLLER WHERE A JOB EXISTS'
8+
exit 1
9+
fi
10+
11+
# Preprare container working directories
12+
export XDG_RUNTIME_DIR=/tmp/nyx/run
13+
14+
# Make sure sandbox has the temporary stuff
15+
mkdir -p /tmp/nyx/sandbox/{tmp/nyx-wd,var/tmp,proc,sys}
16+
17+
# Starts the container and run nyx-build
18+
exec singularity shell --writable --fakeroot --no-home --containall \
19+
-B '/dev/full:/dev/full' \
20+
-B "$HOME/nyx/persistent:/tmp/nyx-home" \
21+
--workdir /tmp /tmp/nyx/sandbox \
22+
--env TERM=$TERM "$@"
23+

job.sh

+14-4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
# Errors in this script are critical
1212
set -euo pipefail
1313

14+
# Sbatch only
15+
if [ -z "${SLURM_JOB_ID:-}" ]; then
16+
echo 'TO RUN WITH SBATCH' >2
17+
exit 1
18+
fi
19+
20+
echo "Welcome to $SLURM_JOB_ID at $(hostname)"
21+
1422
# Logs and tees to Pedro's Telegram
1523
function log() {
1624
echo "$@"
@@ -28,9 +36,11 @@ if [[ "${2:-}" != "-e" ]]; then
2836
singularity build --sandbox /tmp/nyx/sandbox $HOME/nyx/guest/latest
2937
else
3038
mkdir -p /tmp/nyx/sandbox/{tmp/nyx-wd,var/tmp,proc,sys}
31-
[ ! -e /tmp/nyx/sandbox/etc/localtime ] && cp --preserve=links /etc/localtime 7
3239
fi
3340

41+
# Clone network stuff from host
42+
cp /etc/{resolv.conf,hosts} /tmp/nyx/sandbox/etc/
43+
3444
# Prepare nyx-build working directory
3545
_NYX_CURRENT="$HOME/nyx/job/$SLURM_JOB_ID"
3646
mkdir "$_NYX_CURRENT"
@@ -41,7 +51,7 @@ if [[ ${_NYX_BRANCH:0:1} != "/" ]] ; then
4151
log "Invalid Nyx branch $_NYX_BRANCH"
4252
exit 1
4353
fi
44-
_NYX_TARGET_FLAKE="github:chaotic-cx/nyx$_NYX_BRANCH"
54+
_NYX_TARGET_FLAKE="github:chaotic-cx/nyx$_NYX_BRANCH?dir=maintenance"
4555

4656
# Starts the container and run nyx-build
4757
log "Building '$_NYX_TARGET_FLAKE' job $SLURM_JOB_ID at $(hostname)"
@@ -50,8 +60,8 @@ if singularity exec --writable --fakeroot --no-home --containall \
5060
-B "$_NYX_CURRENT:/tmp/nyx-wd" \
5161
-B "$HOME/nyx/persistent:/tmp/nyx-home" \
5262
--workdir /tmp /tmp/nyx/sandbox \
53-
nix develop "$_NYX_TARGET_FLAKE" -c env \
54-
NYX_WD="/tmp/nyx-wd" NYX_HOME="/tmp/nyx-home" \
63+
nix develop --no-write-lock-file "$_NYX_TARGET_FLAKE" --refresh -c env \
64+
NYX_WD="/tmp/nyx-wd" NYX_HOME="/tmp/nyx-home" NYX_PUSH_ALL=1 \
5565
CACHIX_AUTH_TOKEN="$(cat $HOME/nyx/cachix.secret)" \
5666
chaotic-nyx-build; then
5767
log "Finished building '$_NYX_TARGET_FLAKE' job $SLURM_JOB_ID at $(hostname) with $?"

0 commit comments

Comments
 (0)