Skip to content

Instantly share code, notes, and snippets.

@rummik
Created July 9, 2020 14:19
Show Gist options
  • Save rummik/acd1bf7ddc958f4951c7fd6c78832cdf to your computer and use it in GitHub Desktop.
Save rummik/acd1bf7ddc958f4951c7fd6c78832cdf to your computer and use it in GitHub Desktop.
ZSH Python venv shell.nix
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
mkShell {
name = "python-env";
buildInputs = [
python3
];
zshinithook = writeScript "zsh-init-hook.zsh" /* zsh */ ''
export VIRTUAL_ENV_DISABLE_PROMPT=1
python -m venv .venv
source .venv/bin/activate
exec 0</dev/tty
exec 1>/dev/tty
exec 2>/dev/tty
setopt zle
'';
shellHook = /* sh */ ''
exec zsh \
--interactive \
--hist-ignore-space \
--stdin &>/dev/null <<< " source $zshinithook"
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment