How to properly install and configure PyCharm IDE in NixOS?
22:21 27 Aug 2023

In NixOS, I have chosen to install pycharm-community via the NixOS configuration adding these lines to configuration.nix:

  environment.systemPackages = [
    pkgs.jetbrains.pycharm-community
  ];

Now when I run PyCharm and try to create a new project for the first time, it will prompt to add a Python interpreter. However by default, the dropdown list for the interpreter is empty and I do not know how to locate my python interpreter.

Saw some posts about writing a shell.nix file that has a certain postShellHook configuration. (https://www.reddit.com/r/NixOS/comments/i16zvd/how_to_make_pycharm_use_nixshell/)

Though I don't know how can I write that and where it should be located. I still have very little knowledge on NixOS and will appreciate a simple step-by-step solution.

Thanks in advance!

python pycharm interpreter nix nixos