[Solved] Nix in GitHub Codespaces

I’m trying to achieve a one-click Nix/OS playground in GitHub Codespaces, for didactic purposes.

Attempt #1: Quick-and-dirty “docker run -it nixos/nix” succeeds, but obviously does not allow access to repo files.

Attempt #2: building the nixos image directly using .devcontainer.json (“image”: “nixos/nix”), but I’m getting a fatal error on rebuild:


Has anyone successfully run NixOS at the repo level in GitHub Codespaces? I’m only a *nix apprentice, so I welcome any hints along the narrow path to wisdom.

Thanks in advance for your insights! I’ll keep poking around until I make progress.

Minimalist solution by @aryairani.

I now have a “repo-aware” nix repl in Codespaces. Progress!

(For some reason including the Baptist BENOIST Nix language extension in .devcontainer.json crashes this build, so it needs to be added afterward)

1 Like

Very nice! Should the include work at this point?


1 Like

I just realized my mistake and fixed it a minute ago. It should be import, not include.

I come from Julia so I have to overwrite this command in my muscle memory. :slight_smile:

Beautiful! Yes, import makes much more sense :slight_smile:

Thanks for this resource!

1 Like