Skip to content

Commit

Permalink
not including nix environment in dev container
Browse files Browse the repository at this point in the history
  • Loading branch information
heywoodlh committed Nov 27, 2024
1 parent 662c646 commit 0ba244e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 3 deletions.
7 changes: 5 additions & 2 deletions dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ RUN userdel ubuntu \

USER heywoodlh
ENV HOME=/home/heywoodlh
RUN curl -H 'Cache-Control: no-cache' -L https://files.heywoodlh.io/scripts/linux.sh | bash -s -- server \
&& rm -rf /home/heywoodlh/.cache/nix/

USER root
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY sshd.sh /sshd.sh
COPY ttyd.sh /ttyd.sh
COPY heywoodlh.sh /heywoodlh.sh
EXPOSE 22
EXPOSE 8080

VOLUME /nix
VOLUME /home/heywoodlh

ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
4 changes: 4 additions & 0 deletions dev/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ services:
- dind
volumes:
- certs:/certs
- nix:/nix
- heywoodlh-home:/home/heywoodlh
dind:
image: docker.io/docker:dind
restart: unless-stopped
Expand All @@ -24,3 +26,5 @@ services:

volumes:
certs:
nix:
heywoodlh-home:
11 changes: 11 additions & 0 deletions dev/heywoodlh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

# If tmux not installed, then assume flake not setup
if [[ ! -e /home/heywoodlh/.nix-profile/bin/tmux ]]
then
curl -H 'Cache-Control: no-cache' -L https://files.heywoodlh.io/scripts/linux.sh | bash -s -- server \
&& rm -rf /home/heywoodlh/.cache/nix/

## kill ttyd after tmux install
[[ -e /home/heywoodlh/.nix-profile/bin/tmux ]] && sudo pkill -9 ttyd
fi
8 changes: 8 additions & 0 deletions dev/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,11 @@ user=root
command=/ttyd.sh
user=root
autostart=true
autorestart=true

[program:heywoodlh]
command=/heywoodlh.sh
user=heywoodlh
autostart=true
autorestart=false
startsecs=0
5 changes: 4 additions & 1 deletion dev/ttyd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ then
TTYD_ARGS="${TTYD_ARGS} --credential ${TTYD_USER}:${TTYD_PASS}"
fi

ttyd -p 80 --uid 1000 --gid 1000 -w /home/heywoodlh --writable ${TTYD_ARGS} /home/heywoodlh/.nix-profile/bin/tmux
COMMAND="/bin/bash"
[[ -e /home/heywoodlh/.nix-profile/bin/tmux ]] && COMMAND="/home/heywoodlh/.nix-profile/bin/tmux"

ttyd -p 80 --uid 1000 --gid 1000 -w /home/heywoodlh --writable ${TTYD_ARGS} ${COMMAND}

0 comments on commit 0ba244e

Please sign in to comment.