Skip to content

Instantly share code, notes, and snippets.

@andreslucena
Last active January 19, 2026 12:48
Show Gist options
  • Select an option

  • Save andreslucena/e6cfc4bab2560a72ebfa6c779f32ed79 to your computer and use it in GitHub Desktop.

Select an option

Save andreslucena/e6cfc4bab2560a72ebfa6c779f32ed79 to your computer and use it in GitHub Desktop.
A devcontainer script for decidim - a wrapper for fixing the horrible devcontianer CLI DX

If you want to use my tooling :)

wget https://gist.githubusercontent.com/andreslucena/e6cfc4bab2560a72ebfa6c779f32ed79/raw/c076487d507a46435b8e4fd776cf9a83d058144e/devcontainer.local.postCreateCommand.bash -O .devcontainer/devcontainer.local.postCreateCommand.bash 
wget https://gist.githubusercontent.com/andreslucena/e6cfc4bab2560a72ebfa6c779f32ed79/raw/c076487d507a46435b8e4fd776cf9a83d058144e/devcontainer.local.json -O .devcontainer/devcontainer.local.json
{
"postCreateCommand": ".devcontainer/devcontainer.local.postCreateCommand.bash",
"remoteEnv": {
"TERM": "xterm-256color",
"COLORTERM": "truecolor"
},
"mounts": [
"source=/home/apereira/Work/decidim-org/decidim/.git,target=/home/apereira/Work/decidim-org/decidim/.git,type=bind"
]
}
#!/usr/bin/env bash
set -e
set -o
sudo apt-get update
# Fix ownership if /nix exists from a previous container run (volume persistence)
# if [ -d /nix ]; then
# sudo chown -R vscode /nix
# fi
sh <(curl --proto '=https' --tlsv1.2 -L https://nixos.org/nix/install) --no-daemon --yes
# Install nix
cd $HOME
mkdir -p .config/nix/
echo "experimental-features = nix-command flakes" > .config/nix/nix.conf
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
echo '. "$HOME/.nix-profile/etc/profile.d/nix.sh"' >> ~/.bashrc
# Install home-manager
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
nix-shell '<home-manager>' -A install
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
echo '. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"' >> ~/.bashrc
# Install dotfiles
git clone https://github.com/andreslucena/dotfiles
home-manager switch --flake /home/vscode/dotfiles/nix#devcontainer
cd /workspaces/decidim
gem install ruby-lsp
# Use system compiler/linker for native gem extensions
# Nix's gcc/ld wrapper doesn't know about Debian system library paths (/usr/lib/x86_64-linux-gnu)
# We create simple redirects to system binaries and prepend them to PATH
SYSTEM_BIN=$(mktemp -d)
for cmd in gcc g++ ld; do
printf '#!/bin/sh\nexec /usr/bin/%s "$@"\n' "$cmd" > "$SYSTEM_BIN/$cmd"
chmod +x "$SYSTEM_BIN/$cmd"
done
export PATH="$SYSTEM_BIN:$PATH"
bin/setup
rm -rf "$SYSTEM_BIN"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment