Skip to content

Instantly share code, notes, and snippets.

@finloop
Created November 28, 2021 09:06
Show Gist options
  • Save finloop/bd3c64e94ea7f0880e73ab8e1cc9540a to your computer and use it in GitHub Desktop.
Save finloop/bd3c64e94ea7f0880e73ab8e1cc9540a to your computer and use it in GitHub Desktop.
Nix-shell: Pycharm + mach-nix config (nixos)
let
pkgs = import <nixpkgs> { };
mach-nix = import (builtins.fetchGit {
url = "https://github.com/DavHau/mach-nix/";
ref = "master";
}) { python = "python38"; };
customPython = mach-nix.mkPython rec {
providers._default = "wheel,conda,nixpkgs,sdist";
requirements = builtins.readFile ./requirements.txt;
};
in pkgs.mkShell {
buildInputs = [ customPython ];
venvDir = "venv38";
src = null;
shellHook = ''
virtualenv --no-setuptools venv
export PATH=$PWD/venv/bin:$PATH
export PYTHONPATH=venv/lib/python3.8/site-packages/:$PYTHONPATH
'';
postShellHook = ''
ln -sf ${customPython}/lib/python3.8/site-packages/* ./venv/lib/python3
.8/site-packages
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment