Seamless nix integration for Intellij IDEA

submited by
Style Pass
2021-06-08 11:00:07

Nix is a linux package manager that allows users to create programming environments that are completely independent of each other. The manifests of these environments look like this:

This manifest creates a patched version of libpqxx that will only exists inside the environment it will generate. That way users can maintain a separate manifest for each project. When they want to work on a project, they can launch a shell in its environment. Previously my workflow with the nix package manager looked like this:

But if I wanted to work on a project whose environment differs from the one in which the current intellij instance is running, I had to kill the current instance and launch another instance in the new environment before I could start working on that project.

Enter Nix Shell is an intellij plugin that adds a "run" button to nix files that you open in the ide. When you press this button, the plugin will capture the environment of that nix environment and inject it into the intellij process, effectively moving the whole IDE into that nix shell:

Leave a Comment