Last active
August 29, 2015 14:16
-
-
Save sjagoe/1307f5d16a66a5916c8d to your computer and use it in GitHub Desktop.
common-shell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
allowUnfree = true; | |
packageOverrides = pkgs: with pkgs; { | |
pythonDevEnv = stdenv.mkDerivation { | |
name = "basic-python-env"; | |
buildInputs = [ | |
openssh | |
git | |
stdenv | |
]; | |
shellHook = | |
'' | |
VIRTUAL_ENV="$dev_path/$env_name" | |
if [ ! -d "$env_name" ] | |
then | |
virtualenv --python=python3.4 "$VIRTUAL_ENV" | |
fi | |
export VIRTUAL_ENV | |
PATH="$VIRTUAL_ENV/bin:$PATH" | |
export PATH | |
if [ -n "$PYTHONHOME" ] ; then | |
unset PYTHONHOME | |
fi | |
if [ -z "$VIRTUAL_ENV_DISABLE_PROMPT" ] ; then | |
if [ "x" != x ] ; then | |
PS1="$PS1" | |
else | |
if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then | |
# special case for Aspen magic directories | |
# see http://www.zetadev.com/software/aspen/ | |
PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1" | |
else | |
PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1" | |
fi | |
fi | |
export PS1 | |
fi | |
alias pydoc="python -m pydoc" | |
''; | |
}; | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ nix-shell --show-trace ~/.shells/test.nix | |
error: while evaluating ‘overrideDerivation’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/customisation.nix":65:32, called from "/home/sjagoe/.shells/test.nix":6:11: | |
while evaluating ‘makeOverridable’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/customisation.nix":56:24, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/customisation.nix":66:13: | |
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/customisation.nix":66:30, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/customisation.nix":58:12: | |
while evaluating ‘overrideDerivation’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/customisation.nix":34:29, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/customisation.nix":66:36: | |
while evaluating ‘addPassthru’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/customisation.nix":109:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/customisation.nix":37:8: | |
attempt to call something which is not a function but a set, at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/customisation.nix":36:45 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with import <nixpkgs> {}; | |
with pkgs.python34Packages; | |
{ | |
pyEnv = stdenv.overrideDerivation pythonDevEnv (attrs: {}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with import <nixpkgs> {}; | |
with pkgs.python34Packages; | |
{ | |
pyEnv = stdenv.overrideDerivation pythonDevEnv (attrs: { | |
name = "test"; | |
buildInputs = attrs.buildInputs ++ [ | |
python34 | |
python34Packages.pip | |
python34Packages.virtualenv | |
]; | |
shellHook = | |
'' | |
dev_path=/home/sjagoe/some/path | |
env_name=test | |
'' + attrs.shellHook; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment