Last active
December 30, 2025 11:43
-
-
Save alpgul/0d8b62f81cf557567da4e79f96cb70ce to your computer and use it in GitHub Desktop.
Google IDX üzerinde VS Code Remote Tunnel kurulumunu otomatize eden Nix scripti. Çalışma alanı başladığında CLI aracını indirir, arka planda tüneli başlatır ve GitHub eşleştirme kodunu terminale yazdırır.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { pkgs, ... }: { | |
| channel = "stable-24.11"; | |
| packages = [ pkgs.curl pkgs.gnutar ]; | |
| idx.workspace.onStart = { | |
| manual-tunnel-code = '' | |
| # 1. Eski süreçleri temizle | |
| pkill -f "code-tunnel" || true | |
| # 2. Binary İndirme ve Hazırlama | |
| if [ ! -f "$HOME/code-tunnel-bin" ]; then | |
| echo "📥 Resmi VS Code CLI indiriliyor..." | |
| curl -Lk "https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64" --output /tmp/vscode-cli.tar.gz | |
| tar -xzf /tmp/vscode-cli.tar.gz -C $HOME | |
| mv $HOME/code $HOME/code-tunnel-bin | |
| rm /tmp/vscode-cli.tar.gz | |
| fi | |
| # 3. Symlink Oluşturma (PATH üzerinde erişilebilir yapmak için) | |
| # /usr/bin yerine ~/.local/bin kullanıyoruz çünkü orası yazılabilir. | |
| mkdir -p $HOME/.local/bin | |
| ln -sf $HOME/code-tunnel-bin $HOME/.local/bin/code-tunnel | |
| echo "✅ Symlink oluşturuldu: Artık terminalde 'code-tunnel' komutunu kullanabilirsiniz." | |
| # 4. Tüneli başlat | |
| echo "🚀 Bağımsız tünel başlatılıyor..." | |
| nohup $HOME/code-tunnel-bin tunnel --accept-server-license-terms --name firebase-tunnel > /tmp/tunnel.log 2>&1 & | |
| # 5. Kodu yakala | |
| sleep 10 | |
| echo "--------------------------------------------------------" | |
| grep -E "https://github.com/login/device|[A-Z0-9]{4}-[A-Z0-9]{4}" /tmp/tunnel.log || cat /tmp/tunnel.log | |
| echo "--------------------------------------------------------" | |
| ''; | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment