GitHub Codespace Support

I tried several solution with GitHub Codespace support. They all suffer from one or more issues making these unusable.

  • /tmp and/or /nix directories owners/acl are messed up by features installed
  • docker-in-docker feature fails to install
  • cannot get shell with all package and env variables when codespace starts, so VS Extensions cannot find binaries, and locally things fail to compile because env variables are not set
  • some extensions are written in some Go code which hacks VS code setting to hook into package for VS code plugins

On top of some old solutions I tried half year ago, just tried today:

So what are option people use?

Ideal scenario is support of docker in docker, on VS code start home/devshell installed all packages and setup all env variables, and runs all services if needed. And share stuff with devshell from my flake.

I was able to hack good stuff on home-manager activated within codespace dockerfile. Works well for me.

https://github.com/NixOS/nix/issues/6680

I was here. It really works now.

We fixed lot of things, including backing same nix store cache into docker as used by default dev shell and making tmp/nix folder work. So I can nix develop/run/build and arion docker in Codespace pretty well.

The only still fixing how to init envvars well. As far as I see there is question on how to do it with home-manager :slight_smile:

Started here Home-manager doesn't seem to recognize sessionVariables

Ended trying to run on Codespace hooks source /home/vscode/.nix-profile/etc/profile.d/hm-session-vars.sh, always fails.

2 Likes