Skip to content

feat: add devcontainer configuration with Nix support #112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: add devcontainer configuration with Nix support
Change-Id: I9f23638b2c61e90f4c44c7840dcb0ca32cfcdcd3
Signed-off-by: Thomas Kosiewski <tk@coder.com>
  • Loading branch information
ThomasK33 committed Aug 7, 2025
commit a8df308c064321eaff807991867d3a1af4ccaddf
33 changes: 33 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM mcr.microsoft.com/devcontainers/base:ubuntu

# Install Nix
RUN apt-get update && apt-get install -y \
curl \
xz-utils \
sudo \
&& rm -rf /var/lib/apt/lists/*

# Create vscode user if it doesn't exist
RUN if ! id -u vscode > /dev/null 2>&1; then \
useradd -m -s /bin/bash vscode && \
echo "vscode ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers; \
fi

# Switch to vscode user for Nix installation
USER vscode
WORKDIR /home/vscode

# Install Nix in single-user mode
RUN curl -L https://nixos.org/nix/install | sh -s -- --no-daemon

# Add Nix to PATH and configure for the shell
RUN echo '. /home/vscode/.nix-profile/etc/profile.d/nix.sh' >> /home/vscode/.bashrc && \
mkdir -p /home/vscode/.config/nix && \
echo 'experimental-features = nix-command flakes' >> /home/vscode/.config/nix/nix.conf

# Set up workspace directory
RUN sudo mkdir -p /workspace && sudo chown vscode:vscode /workspace
WORKDIR /workspace

# Keep container running
CMD ["sleep", "infinity"]
23 changes: 23 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "claudecode.nvim Development",
"build": {
"dockerfile": "Dockerfile"
},
"features": {
"ghcr.io/devcontainers/features/git:1": {}
},
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "bash"
},
"extensions": ["jnoortheen.nix-ide"]
}
},
"postCreateCommand": "bash .devcontainer/post-create.sh",
"remoteUser": "vscode",
"mounts": [
"source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached"
],
"workspaceFolder": "/workspace"
}
31 changes: 31 additions & 0 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# Source Nix environment
. /home/vscode/.nix-profile/etc/profile.d/nix.sh

# Verify Nix is available
if ! command -v nix &>/dev/null; then
echo "Error: Nix is not installed properly"
exit 1
fi

echo "✅ Nix is installed and available"
echo ""
echo "📦 claudecode.nvim Development Container Ready!"
echo ""
echo "To enter the development shell with all dependencies, run:"
echo " nix develop"
echo ""
echo "This will provide:"
echo " - Neovim"
echo " - Lua and LuaJIT"
echo " - busted (test framework)"
echo " - luacheck (linter)"
echo " - stylua (formatter)"
echo " - All other development tools"
echo ""
echo "You can also run development commands directly:"
echo " - make # Run full validation (format, lint, test)"
echo " - make test # Run tests"
echo " - make check # Run linter"
echo " - make format # Format code"