11
11
# Errors in this script are critical
12
12
set -euo pipefail
13
13
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
+
14
22
# Logs and tees to Pedro's Telegram
15
23
function log() {
16
24
echo " $@ "
@@ -28,9 +36,11 @@ if [[ "${2:-}" != "-e" ]]; then
28
36
singularity build --sandbox /tmp/nyx/sandbox $HOME /nyx/guest/latest
29
37
else
30
38
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
32
39
fi
33
40
41
+ # Clone network stuff from host
42
+ cp /etc/{resolv.conf,hosts} /tmp/nyx/sandbox/etc/
43
+
34
44
# Prepare nyx-build working directory
35
45
_NYX_CURRENT=" $HOME /nyx/job/$SLURM_JOB_ID "
36
46
mkdir " $_NYX_CURRENT "
@@ -41,7 +51,7 @@ if [[ ${_NYX_BRANCH:0:1} != "/" ]] ; then
41
51
log " Invalid Nyx branch $_NYX_BRANCH "
42
52
exit 1
43
53
fi
44
- _NYX_TARGET_FLAKE=" github:chaotic-cx/nyx$_NYX_BRANCH "
54
+ _NYX_TARGET_FLAKE=" github:chaotic-cx/nyx$_NYX_BRANCH ?dir=maintenance "
45
55
46
56
# Starts the container and run nyx-build
47
57
log " Building '$_NYX_TARGET_FLAKE ' job $SLURM_JOB_ID at $( hostname) "
@@ -50,8 +60,8 @@ if singularity exec --writable --fakeroot --no-home --containall \
50
60
-B " $_NYX_CURRENT :/tmp/nyx-wd" \
51
61
-B " $HOME /nyx/persistent:/tmp/nyx-home" \
52
62
--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 \
55
65
CACHIX_AUTH_TOKEN=" $( cat $HOME /nyx/cachix.secret) " \
56
66
chaotic-nyx-build; then
57
67
log " Finished building '$_NYX_TARGET_FLAKE ' job $SLURM_JOB_ID at $( hostname) with $? "
0 commit comments