Skip to content

Commit 7fc21c8

Browse files
committed
Refactor Dockerfile and entrypoint scripts to remove powerlevel10k theme, update VS Code extensions, and enhance SSH setup. Adjust settings for editor and improve configuration handling in demyx scripts.
1 parent d4a5388 commit 7fc21c8

22 files changed

Lines changed: 480 additions & 474 deletions

File tree

tag-browse/Dockerfile

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ RUN set -ex; \
4141
less \
4242
nano \
4343
net-tools \
44-
openssh-client \
44+
ssh \
4545
procps \
4646
sudo \
4747
tzdata \
@@ -78,7 +78,6 @@ RUN set -ex; \
7878
\
7979
# Oh-My-Zsh
8080
su -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" -s /bin/sh demyx; \
81-
su -c "git clone --depth=1 https://github.com/romkatv/powerlevel10k.git /home/demyx/.oh-my-zsh/custom/themes/powerlevel10k" -s /bin/sh demyx; \
8281
su -c "git clone https://github.com/zsh-users/zsh-autosuggestions.git /home/demyx/.oh-my-zsh/custom/plugins/zsh-autosuggestions" -s /bin/sh demyx; \
8382
su -c "git clone https://github.com/TamCore/autoupdate-oh-my-zsh-plugins.git /home/demyx/.oh-my-zsh/custom/plugins/autoupdate" -s /bin/sh demyx; \
8483
sed -i 's|source $ZSH/oh-my-zsh.sh|source "$DEMYX_CONFIG"/.demyxrc\nsource $ZSH/oh-my-zsh.sh|g' /home/demyx/.zshrc; \
@@ -113,28 +112,13 @@ RUN set -ex; \
113112
\
114113
# Install default extensions
115114
code-server --extensions-dir="$DEMYX_CODE_CONFIG"/extensions \
116-
--install-extension=equinusocio.vsc-material-theme \
117-
--install-extension=pkief.material-icon-theme \
115+
--install-extension=catppuccin.catppuccin-vsc \
116+
--install-extension=catppuccin.catppuccin-vsc-icons \
117+
--install-extension=shevaua.phpcs \
118+
--install-extension=felixfbecker.php-debug \
118119
--install-extension=remisa.shellman \
119120
--install-extension=timonwong.shellcheck; \
120121
\
121-
# Custom fonts
122-
cd /usr/local/lib/code-server/src/browser/pages; \
123-
curl -O "https://demyx.sh/fonts/{meslolgs-nf-regular.woff,meslolgs-nf-bold.woff,meslolgs-nf-italic.woff,meslolgs-nf-bold-italic.woff}"; \
124-
\
125-
CODE_WORKBENCH="$(find /usr/local/lib/code-server -name "*workbench.html")"; \
126-
sed -i "s|</head>|\
127-
<style> \n\
128-
@font-face { \n\
129-
font-family: 'MesloLGS NF'; \n\
130-
font-style: normal; \n\
131-
src: url('_static/src/browser/pages/meslolgs-nf-regular.woff') format('woff'), \n\
132-
url('_static/src/browser/pages/meslolgs-nf-bold.woff') format('woff'), \n\
133-
url('_static/src/browser/pages/meslolgs-nf-italic.woff') format('woff'), \n\
134-
url('_static/src/browser/pages/meslolgs-nf-bold-italic.woff') format('woff'); \n\
135-
} \n\
136-
\n\</style></head>|g" "$CODE_WORKBENCH"; \
137-
\
138122
# Finalize code-server
139123
chown -R demyx:demyx "$DEMYX_CODE_CONFIG"; \
140124
chown -R demyx:demyx "$DEMYX_CONFIG"; \
@@ -146,7 +130,7 @@ RUN set -ex; \
146130
cp "$DEMYX_CONFIG"/ctop /home/demyx/.ctop; \
147131
\
148132
# sudo
149-
echo "demyx ALL=(ALL) NOPASSWD: /usr/bin/apt" > /etc/sudoers.d/demyx; \
133+
echo "demyx ALL=(ALL) NOPASSWD:SETENV: /usr/bin/apt, /usr/local/bin/demyx-ssh" > /etc/sudoers.d/demyx; \
150134
\
151135
# Set ownership
152136
chown -R root:root /usr/local/bin; \

tag-browse/bin/demyx-entrypoint

Lines changed: 80 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,100 @@
11
#!/bin/bash
22
# Demyx
33
# https://demyx.sh
4-
set -euo pipefail
5-
6-
# Support for old password variable
7-
[[ -n "${PASSWORD:-}" ]] && DEMYX_CODE_PASSWORD="$PASSWORD"
8-
9-
# Copy ctop settings if it doesn't exist
10-
if [[ ! -f /home/demyx/.ctop ]]; then
11-
cp "$DEMYX_CONFIG"/ctop /home/demyx/.ctop
12-
fi
13-
14-
# Create new code-server config directory
15-
if [[ ! -d /home/demyx/.config ]]; then
16-
mkdir -p /home/demyx/.config
17-
cp -r "$DEMYX_CONFIG"/code-server /home/demyx/.config
18-
fi
4+
set -eEuo pipefail
5+
#
6+
# Main.
7+
#
8+
demyx_entrypoint() {
9+
# Copy ctop settings if it doesn't exist
10+
if [[ ! -f /home/demyx/.ctop ]]; then
11+
cp "$DEMYX_CONFIG"/ctop /home/demyx/.ctop
12+
fi
1913

20-
# Migrate old configs to new directory
21-
if [[ -d /home/demyx/.code/data ]]; then
22-
mkdir -p "$DEMYX_CODE_CONFIG"/data
23-
cp -r /home/demyx/.code/data/. "$DEMYX_CODE_CONFIG"
24-
rm -rf /home/demyx/.code/data
25-
fi
14+
# Create new code-server config directory
15+
if [[ ! -d /home/demyx/.config ]]; then
16+
mkdir -p /home/demyx/.config
17+
cp -r "$DEMYX_CONFIG"/code-server /home/demyx/.config
18+
fi
2619

27-
if [[ -d /home/demyx/.code/extensions ]]; then
28-
mkdir -p "$DEMYX_CODE_CONFIG"/extensions
29-
cp -r /home/demyx/.code/extensions/. "$DEMYX_CODE_CONFIG"
30-
rm -rf /home/demyx/.code/extensions
31-
fi
20+
# Migrate old configs to new directory
21+
if [[ -d /home/demyx/.code/data ]]; then
22+
mkdir -p "$DEMYX_CODE_CONFIG"/data
23+
cp -r /home/demyx/.code/data/. "$DEMYX_CODE_CONFIG"
24+
rm -rf /home/demyx/.code/data
25+
fi
3226

33-
# Update oh-my-zsh
34-
if [[ -f /home/demyx/.zshrc ]]; then
35-
DEMYX_ZSHRC_CHECK="$(cat < /home/demyx/.zshrc)"
36-
if [[ "$DEMYX_ZSHRC_CHECK" != *"source \"\$DEMYX_CONFIG\""* ]]; then
37-
sed -i "s|source \$ZSH/oh-my-zsh.sh|source \"\$DEMYX_CONFIG\"/.demyxrc\nsource \$ZSH/oh-my-zsh.sh|g" /home/demyx/.zshrc
27+
if [[ -d /home/demyx/.code/extensions ]]; then
28+
mkdir -p "$DEMYX_CODE_CONFIG"/extensions
29+
cp -r /home/demyx/.code/extensions/. "$DEMYX_CODE_CONFIG"
30+
rm -rf /home/demyx/.code/extensions
3831
fi
3932

33+
# Update oh-my-zsh
34+
if [[ -f /home/demyx/.zshrc ]]; then
35+
DEMYX_ZSHRC_CHECK="$(cat < /home/demyx/.zshrc)"
36+
if [[ "$DEMYX_ZSHRC_CHECK" != *"source \"\$DEMYX_CONFIG\""* ]]; then
37+
sed -i "s|source \$ZSH/oh-my-zsh.sh|source \"\$DEMYX_CONFIG\"/.demyxrc\nsource \$ZSH/oh-my-zsh.sh|g" /home/demyx/.zshrc
38+
fi
39+
4040
# Remove export GPG_TTY
4141
if [[ "$DEMYX_ZSHRC_CHECK" == *"export GPG_TTY"* ]]; then
4242
sed -i "/export GPG_TTY/d" /home/demyx/.zshrc
4343
fi
44-
fi
45-
46-
# Remove autoupdate
47-
if [[ -d /home/demyx/.oh-my-zsh/plugins/autoupdate ]]; then
48-
rm -rf /home/demyx/.oh-my-zsh/plugins/autoupdate
49-
fi
50-
# Double check zsh-autosuggestions
51-
if [[ ! -d /home/demyx/.oh-my-zsh/custom/plugins/zsh-autosuggestions ]]; then
52-
git clone https://github.com/zsh-users/zsh-autosuggestions.git /home/demyx/.oh-my-zsh/custom/plugins/zsh-autosuggestions
53-
fi
44+
fi
5445

55-
# Remove autoupdate
56-
if [[ -d /home/demyx/.oh-my-zsh/plugins/autoupdate ]]; then
57-
rm -rf /home/demyx/.oh-my-zsh/plugins/autoupdate
58-
fi
59-
# Double check autoupdate
60-
if [[ ! -d /home/demyx/.oh-my-zsh/custom/plugins/autoupdate ]]; then
61-
git clone https://github.com/TamCore/autoupdate-oh-my-zsh-plugins.git /home/demyx/.oh-my-zsh/custom/plugins/autoupdate
62-
fi
46+
# Remove autoupdate
47+
if [[ -d /home/demyx/.oh-my-zsh/plugins/autoupdate ]]; then
48+
rm -rf /home/demyx/.oh-my-zsh/plugins/autoupdate
49+
fi
50+
# Double check zsh-autosuggestions
51+
if [[ ! -d /home/demyx/.oh-my-zsh/custom/plugins/zsh-autosuggestions ]]; then
52+
git clone https://github.com/zsh-users/zsh-autosuggestions.git /home/demyx/.oh-my-zsh/custom/plugins/zsh-autosuggestions
53+
fi
6354

64-
# Double check powerlevel10k theme
65-
if [[ ! -d /home/demyx/.oh-my-zsh/custom/themes/powerlevel10k ]]; then
66-
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git /home/demyx/.oh-my-zsh/custom/themes/powerlevel10k
67-
fi
55+
# Remove autoupdate
56+
if [[ -d /home/demyx/.oh-my-zsh/plugins/autoupdate ]]; then
57+
rm -rf /home/demyx/.oh-my-zsh/plugins/autoupdate
58+
fi
59+
# Double check autoupdate
60+
if [[ ! -d /home/demyx/.oh-my-zsh/custom/plugins/autoupdate ]]; then
61+
git clone https://github.com/TamCore/autoupdate-oh-my-zsh-plugins.git /home/demyx/.oh-my-zsh/custom/plugins/autoupdate
62+
fi
6863

69-
# Check for font-family
70-
DEMYX_SETTINGS_CHECK="$(cat < "$DEMYX_CODE_CONFIG"/data/User/settings.json)"
71-
if [[ "$DEMYX_SETTINGS_CHECK" != *"MesloLGS NF"* ]]; then
72-
sed -i "s|\"editor.quickSuggestions\": true,|\
73-
\"editor.fontFamily\": \"'MesloLGS NF', Menlo, Monaco, 'Courier New', monospace\",\n\
74-
\"editor.quickSuggestions\": true,|g" "$DEMYX_CODE_CONFIG"/data/User/settings.json
75-
fi
64+
# Symlink /demyx directory
65+
if [[ ! -L /home/demyx/demyx ]]; then
66+
ln -sf "$DEMYX" /home/demyx/demyx
67+
fi
7668

77-
# Symlink /demyx directory
78-
if [[ ! -L /home/demyx/demyx ]]; then
79-
ln -sf "$DEMYX" /home/demyx/demyx
80-
fi
69+
# Check demyx motd is in ~/.zshrc
70+
DEMYX_ENTRYPOINT_MOTD="$(grep "demyx motd" ~/.zshrc || true)"
71+
if [[ -z "$DEMYX_ENTRYPOINT_MOTD" ]]; then
72+
echo "demyx motd" >> ~/.zshrc
73+
fi
8174

82-
# Check demyx motd is in ~/.zshrc
83-
DEMYX_ENTRYPOINT_MOTD="$(grep "demyx motd" ~/.zshrc || true)"
84-
if [[ -z "$DEMYX_ENTRYPOINT_MOTD" ]]; then
85-
echo "demyx motd" >> ~/.zshrc
86-
fi
75+
# TEMPORARY
76+
DEMYX_ENTRYPOINT_THEME="$(find "${DEMYX_CODE_CONFIG}"/extensions -name "equinusocio*")"
77+
if [[ -n "${DEMYX_ENTRYPOINT_THEME}" ]]; then
78+
rm -rf "${DEMYX_CODE_CONFIG}"/extensions/equinusocio*
79+
fi
8780

88-
# Generate code-server yaml
89-
echo "auth: $DEMYX_CODE_AUTH
90-
bind-addr: $DEMYX_CODE_BIND_ADDR
91-
cert: false
92-
disable-telemetry: true
93-
extensions-dir: ${DEMYX_CODE_CONFIG}/extensions
94-
password: $DEMYX_CODE_PASSWORD
95-
user-data-dir: ${DEMYX_CODE_CONFIG}/data" > "$DEMYX_CODE_CONFIG"/config.yaml
81+
# Generate code-server yaml
82+
echo "auth: \"$DEMYX_CODE_AUTH\"
83+
bind-addr: \"$DEMYX_CODE_BIND_ADDR\"
84+
cert: false
85+
disable-telemetry: true
86+
extensions-dir: \"${DEMYX_CODE_CONFIG}/extensions\"
87+
password: \"$DEMYX_CODE_PASSWORD\"
88+
user-data-dir: \"${DEMYX_CODE_CONFIG}/data\"" | sed 's| ||g' > "$DEMYX_CODE_CONFIG"/config.yaml
9689

97-
# Start code-server
90+
# SSH
91+
sudo -E demyx-ssh
92+
}
93+
#
94+
# Init.
95+
#
96+
demyx_entrypoint
97+
#
98+
#
99+
#
98100
code-server /home/demyx

tag-browse/bin/demyx-ssh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
# Demyx
3+
# https://demyx.sh
4+
set -eEuo pipefail
5+
#
6+
#
7+
#
8+
demyx_ssh() {
9+
local DEMYX_SSH_HOME=/home/demyx
10+
11+
# Prevents ssh errors from local machine
12+
if [[ -f "${DEMYX_SSH_HOME}"/.ssh/ssh_host_rsa_key ]]; then
13+
if [[ ! -f /etc/ssh/ssh_host_rsa_key ]]; then
14+
cp "${DEMYX_SSH_HOME}"/.ssh/ssh_host_rsa_key /etc/ssh
15+
fi
16+
if [[ ! -f /etc/ssh/ssh_host_rsa_key.pub ]]; then
17+
cp "${DEMYX_SSH_HOME}"/.ssh/ssh_host_rsa_key.pub /etc/ssh
18+
fi
19+
else
20+
if [[ ! -f /etc/ssh/ssh_host_rsa_key ]]; then
21+
ssh-keygen -A >/dev/null
22+
fi
23+
if [[ ! -f "${DEMYX_SSH_HOME}"/.ssh/ssh_host_rsa_key ]]; then
24+
cp /etc/ssh/ssh_host_rsa_key "${DEMYX_SSH_HOME}"/.ssh
25+
fi
26+
if [[ ! -f "${DEMYX_SSH_HOME}"/.ssh/ssh_host_rsa_key.pub ]]; then
27+
cp /etc/ssh/ssh_host_rsa_key.pub "${DEMYX_SSH_HOME}"/.ssh
28+
fi
29+
fi
30+
31+
touch /run/sshd.pid
32+
chown demyx:demyx /run/sshd.pid
33+
chmod 700 "${DEMYX_SSH_HOME}"/.ssh
34+
chmod 600 /etc/ssh/ssh_host_rsa_key
35+
chown demyx:demyx /etc/ssh/ssh_host_rsa_key
36+
chown demyx:demyx /etc/ssh/ssh_host_rsa_key.pub
37+
chown -R demyx:demyx "${DEMYX_SSH_HOME}"
38+
39+
sed -e "s|#PermitRootLogin prohibit-password|PermitRootLogin no|g" \
40+
-e "s|#PubkeyAuthentication|PubkeyAuthentication|g" \
41+
-e "s|#PasswordAuthentication yes|PasswordAuthentication no|g" \
42+
-e "s|#PermitEmptyPasswords no|PermitEmptyPasswords no|g" \
43+
-i /etc/ssh/sshd_config
44+
45+
su -c "/usr/sbin/sshd -E ${DEMYX_LOG}/ssh.log" -s /bin/bash demyx
46+
}
47+
#
48+
#
49+
#
50+
demyx_ssh

tag-browse/config/settings.json

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
2-
"editor.fontFamily": "'MesloLGS NF', Menlo, Monaco, 'Courier New', monospace",
3-
"editor.quickSuggestions": true,
2+
"editor.insertSpaces": false,
3+
"editor.quickSuggestions": {
4+
"comments": "on",
5+
"strings": "on",
6+
"other": "on"
7+
},
48
"files.autoSave": "onFocusChange",
59
"files.exclude": {
610
"**/.git": true,
@@ -22,16 +26,11 @@
2226
"**/node_modules/**": true,
2327
"**/tmp/**": true
2428
},
25-
"material-icon-theme.showReloadMessage": false,
26-
"material-icon-theme.showUpdateMessage": false,
27-
"material-icon-theme.showWelcomeMessage": false,
28-
"materialTheme.accent": "Teal",
2929
"shellcheck.enableQuickFix": true,
3030
"telemetry.enableTelemetry": false,
3131
"terminal.integrated.cursorBlinking": true,
3232
"terminal.integrated.cursorStyle": "line",
3333
"terminal.integrated.gpuAcceleration": "canvas",
34-
"terminal.integrated.shell.linux": "/bin/zsh",
35-
"workbench.colorTheme": "Material Theme Darker High Contrast",
36-
"workbench.iconTheme": "material-icon-theme"
34+
"workbench.colorTheme": "Catppuccin Mocha",
35+
"workbench.iconTheme": "catppuccin-mocha"
3736
}

tag-go/Dockerfile

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ RUN set -ex; \
6969
\
7070
# Oh-My-Zsh
7171
su -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" -s /bin/sh demyx; \
72-
su -c "git clone --depth=1 https://github.com/romkatv/powerlevel10k.git /home/demyx/.oh-my-zsh/custom/themes/powerlevel10k" -s /bin/sh demyx; \
7372
su -c "git clone https://github.com/zsh-users/zsh-autosuggestions.git /home/demyx/.oh-my-zsh/custom/plugins/zsh-autosuggestions" -s /bin/sh demyx; \
7473
su -c "git clone https://github.com/TamCore/autoupdate-oh-my-zsh-plugins.git /home/demyx/.oh-my-zsh/custom/plugins/autoupdate" -s /bin/sh demyx; \
7574
sed -i 's|source $ZSH/oh-my-zsh.sh|source "$DEMYX_CONFIG"/.demyxrc\nsource $ZSH/oh-my-zsh.sh|g' /home/demyx/.zshrc; \
@@ -106,32 +105,13 @@ RUN set -ex; \
106105
\
107106
# Install default extensions
108107
code-server --extensions-dir="$DEMYX_CODE_CONFIG"/extensions \
109-
--install-extension=equinusocio.vsc-material-theme \
110-
--install-extension=pkief.material-icon-theme \
108+
--install-extension=catppuccin.catppuccin-vsc \
109+
--install-extension=catppuccin.catppuccin-vsc-icons \
110+
--install-extension=shevaua.phpcs \
111+
--install-extension=felixfbecker.php-debug \
111112
--install-extension=remisa.shellman \
112113
--install-extension=timonwong.shellcheck; \
113114
\
114-
# Tag specifc extensions
115-
code-server --extensions-dir="$DEMYX_CODE_CONFIG"/extensions \
116-
--install-extension=golang.go; \
117-
\
118-
# Custom fonts
119-
cd /usr/local/lib/code-server/src/browser/pages; \
120-
curl -O "https://demyx.sh/fonts/{meslolgs-nf-regular.woff,meslolgs-nf-bold.woff,meslolgs-nf-italic.woff,meslolgs-nf-bold-italic.woff}"; \
121-
\
122-
CODE_WORKBENCH="$(find /usr/local/lib/code-server -name "*workbench.html")"; \
123-
sed -i "s|</head>|\
124-
<style> \n\
125-
@font-face { \n\
126-
font-family: 'MesloLGS NF'; \n\
127-
font-style: normal; \n\
128-
src: url('_static/src/browser/pages/meslolgs-nf-regular.woff') format('woff'), \n\
129-
url('_static/src/browser/pages/meslolgs-nf-bold.woff') format('woff'), \n\
130-
url('_static/src/browser/pages/meslolgs-nf-italic.woff') format('woff'), \n\
131-
url('_static/src/browser/pages/meslolgs-nf-bold-italic.woff') format('woff'); \n\
132-
} \n\
133-
\n\</style></head>|g" "$CODE_WORKBENCH"; \
134-
\
135115
# Finalize code-server
136116
chown -R demyx:demyx "$DEMYX_CODE_CONFIG"; \
137117
chown -R demyx:demyx "$DEMYX_CONFIG"; \

0 commit comments

Comments
 (0)