summaryrefslogtreecommitdiff
path: root/sand
blob: f8ab8c1fa4b2eba53a5e4cdc2be85c80766a3e9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env sh

if [ -z "$1" ]; then
    echo "Must provide a programme to run"
    exit 1
fi;

CMD="$1"

PROJ_DIR="."
if [ -n "$2" ]; then
    PROJ_DIR="$2";
fi;

bwrap \
  --ro-bind /usr /usr \
  --ro-bind /lib /lib \
  --ro-bind /lib64 /lib64 \
  --ro-bind /bin /bin \
  --ro-bind /etc/ssl /etc/ssl \
  --ro-bind /etc/ca-certificates /etc/ca-certificates \
  --ro-bind /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf \
  --bind /nix /nix \
  --dev /dev \
  --proc /proc \
  --tmpfs /home/$(whoami) \
  --tmpfs /tmp \
  --bind ~/.config/jj /home/$(whoami)/.config/jj \
  --bind ~/.cache/huggingface /home/$(whoami)/.cache/huggingface \
  --bind ~/.cargo /home/$(whoami)/.cargo \
  --bind ~/.rustup /home/$(whoami)/.rustup \
  --bind ~/.config/hax /home/$(whoami)/.config/hax \
  --bind ~/.local/state/hax /home/$(whoami)/.local/state/hax \
  --bind ~/.cache/hax /home/$(whoami)/.cache/hax \
  --bind ~/.local/bin/hax /home/$(whoami)/.local/bin/hax \
  --clearenv \
  --setenv HOME /home/$(whoami) \
  --setenv USER $(whoami) \
  --setenv SHELL /bin/bash \
  --setenv TERM foot \
  --setenv KAGI_API_KEY $KAGI_API_KEY \
  --setenv PATH /home/$(whoami)/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin \
  --bind "$PROJ_DIR" /home/$(whoami)/project/ \
  --chdir /home/$(whoami)/project/ \
  $CMD