Codium flake

June 5, 2023 ยท View on GitHub

Set up VSCodium with extensions and executables on its PATH in several lines of Nix code

See Prerequisites

Conventions

In a project with multiple subprojects, one needs to switch between toolsets for each subproject. In some cases, it's convenient to start several VSCodium instances, one per sub-project. Then, one needs to decide how to deliver VSCodium in such a project. There are several options.

  1. A single VSCodium with a superset of required extensions and executables on its PATH over the sub-projects.
  2. A VSCodium per sub-project
  3. A mix of these

Contribute

nix develop
codium .

Troubleshooting

Missing extensions

Only one instance of VSCodium gets supplied extensions. Close other instances of VSCodium before opening a new one.

GitHub Personal Access Token (PAT) for VS Codium extensions

  • Create a classic PAT with permissions: read:user, repo, user:email, workflow
  • Supply it to extensions

Missing binaries on PATH in VSCodium

Case: VSCodium doesn't have the binaries provided in runtimeDependencies (like here) on PATH:

  1. You need to repair VSCodium's derivation
  2. Assumptions:
    • current directory is DIR
    • there is a DIR/flake.nix
    • VSCodium is given as a derivation codium, like here
    • In ./flake.nix, you should have a packages.codium, like here
  3. Check:
    1. Start VSCodium: nix run .#codium .
    2. Open a VSCodium terminal
    3. echo $PATH there
    4. It doesn't contain /bin dirs of specified runtimeDependencies
  4. Close:
    • devshells with this VSCodium
    • VSCodium itself
  5. Remove direnv profiles:
    • cd DIR && rm -rf .direnv
  6. Open a new terminal, cd DIR
  7. Run nix store repair .#codium
  8. Make a Check (see above) to verify binaries are on PATH
  9. If still no, continue
  10. Restart your OS
  11. nix store gc - collect garbage in Nix store - man
  12. Again, make a Check