shell.nix
66 lines
| 1.7 KiB
| text/x-nix
|
NixLexer
r472 | # This file contains the adjustments which are desired for a development | |||
# environment. | ||||
{ pkgs ? (import <nixpkgs> {}) | ||||
, pythonPackages ? "python27Packages" | ||||
r96 | , doCheck ? false | |||
r0 | }: | |||
let | ||||
r96 | ||||
r34 | vcsserver = import ./default.nix { | |||
r472 | inherit | |||
doCheck; | ||||
r34 | }; | |||
r0 | ||||
Martin Bornhold
|
r95 | vcs-pythonPackages = vcsserver.pythonPackages; | ||
r970 | in vcsserver.override (attrs: rec { | |||
r0 | # Avoid that we dump any sources into the store when entering the shell and | |||
# make development a little bit more convenient. | ||||
src = null; | ||||
r472 | # Add dependencies which are useful for the development environment. | |||
r96 | buildInputs = | |||
attrs.buildInputs ++ | ||||
(with vcs-pythonPackages; [ | ||||
ipdb | ||||
]); | ||||
r472 | # place to inject some required libs from develop installs | |||
propagatedBuildInputs = | ||||
attrs.propagatedBuildInputs ++ | ||||
[]; | ||||
# Make sure we execute both hooks | ||||
shellHook = '' | ||||
runHook preShellHook | ||||
runHook postShellHook | ||||
''; | ||||
preShellHook = '' | ||||
r970 | echo "Entering vcsserver-shell" | |||
Martin Bornhold
|
r95 | |||
# Custom prompt to distinguish from other dev envs. | ||||
r970 | export PS1="\n\[\033[1;32m\][vcsserver-shell:\w]$\[\033[0m\] " | |||
Martin Bornhold
|
r95 | |||
r472 | # Set locale | |||
r970 | export LOCALE_ARCHIVE="${pkgs.glibcLocales}/lib/locale/locale-archive" | |||
r472 | export LC_ALL="en_US.UTF-8" | |||
# Setup a temporary directory. | ||||
Martin Bornhold
|
r95 | tmp_path=$(mktemp -d) | ||
r970 | export PATH="${pkgs.subversion}/bin:${pkgs.git}/bin:${vcs-pythonPackages.mercurial}/bin:$tmp_path/bin:$PATH" | |||
Martin Bornhold
|
r95 | export PYTHONPATH="$tmp_path/${vcs-pythonPackages.python.sitePackages}:$PYTHONPATH" | ||
mkdir -p $tmp_path/${vcs-pythonPackages.python.sitePackages} | ||||
r472 | ||||
# Develop installation | ||||
echo "[BEGIN]: develop install of rhodecode-vcsserver" | ||||
Martin Bornhold
|
r95 | python setup.py develop --prefix $tmp_path --allow-hosts "" | ||
''; | ||||
r472 | ||||
postShellHook = '' | ||||
''; | ||||
r0 | }) | |||