-
Notifications
You must be signed in to change notification settings - Fork 3
/
entrypoint
executable file
·80 lines (66 loc) · 2.36 KB
/
entrypoint
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env bash
running_in_docker() {
(awk -F/ '$2 == "docker"' /proc/self/cgroup | read non_empty_input)
}
rsync -a $HOME_TEMPLATE/ $HOME
read -r -d '' SOURCE_NIX <<- 'EOM'
if [ -z ${NO_NIX} ]; then
source /home/brandon/.nix-profile/etc/profile.d/nix.sh
fi
EOM
eval $SOURCE_NIX
# grep -q -F "${SOURCE_NIX}" $HOME/.bashrc || printf "\n$SOURCE_NIX\n" >> $HOME/.bashrc
printf "\n$SOURCE_NIX\n" >> $HOME/.bashrc
PS1_MOD='export PS1='\''\u@\h-DevContainer:\w\n\$ '\'''
eval $PS1_MOD
grep -q -F "${PS1_MOD}" $HOME/.bashrc || printf "\n$PS1_MOD\n" >> $HOME/.bashrc
touch $HOME/.stignore && \
grep -q -F '#include .home_sync_ignore' $HOME/.stignore || echo '#include .home_sync_ignore' >> $HOME/.stignore
if grep -q docker /proc/self/cgroup; then
SET_DYNAMIC_ENV="source $HOME/workspace/docker-nix-intellij/nix-env-dynamic.sh"
eval $SET_DYNAMIC_ENV
grep -q -F "${SET_DYNAMIC_ENV}" $HOME/.bashrc || printf "\n$SET_DYNAMIC_ENV\n" >> $HOME/.bashrc
fi
read -r -d '' ACME_CD_PATCH <<- 'EOM'
## ***ACME_CD_PATCH***
## If inside Acme...
if [ "$winid" ]; then
## ... then patch the `cd` command
_cd () {
\cd "$@" && awd
}
alias cd=_cd
## Customize a prompt inside Acme
export PS1='$ '
fi
EOM
eval $ACME_CD_PATCH
grep -q -F "ACME_CD_PATCH" $HOME/.bashrc || printf "\n$ACME_CD_PATCH\n" >> $HOME/.bashrc
SET_TERM="export TERM=screen"
eval $SET_TERM
grep -q -F "${SET_TERM}" $HOME/.bashrc || printf "\n$SET_TERM\n" >> $HOME/.bashrc
#Primarily for WSL2's benefit; don't think this is useful elsewhere
if [[ $(uname -a) == *microsoft* ]]; then
SET_DISPLAY="export DISPLAY=\$(awk '/nameserver / {print \$2; exit}' /etc/resolv.conf 2>/dev/null):0"
SET_LIBGL="export LIBGL_ALWAYS_INDIRECT=1"
grep -q -F "${SET_DISPLAY}" $HOME/.bashrc || printf "\n$SET_DISPLAY\n" >> $HOME/.bashrc
grep -q -F "${SET_LIBGL}" $HOME/.bashrc || printf "\n$SET_LIBGL\n" >> $HOME/.bashrc
fi
mkdir -p "$HOME/.config/fontconfig"
cat > "$HOME/.config/fontconfig/fonts.conf" <<-EOF
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<dir>~/.nix-profile/share/fonts</dir>
</fontconfig>
EOF
fc-cache -f -v
touch /tmp/syncthing.log
mv -b /tmp/syncthing.log /tmp/syncthing.log.1
#if grep -qi Microsoft /proc/version; then
# echo "WSL detected; not starting syncthing (use Syncthing on Windows)"
#else
syncthing -gui-address 0.0.0.0:8384 2>&1 > /tmp/syncthing.log &
#fi
cd $HOME
emacs -nw