diff --git a/shell.nix b/shell.nix --- a/shell.nix +++ b/shell.nix @@ -1,34 +1,14 @@ { pkgs ? (import {}) -, vcsserverPath ? "./../rhodecode-vcsserver" -, vcsserverNix ? "shell.nix" +, pythonPackages ? "python27Packages" , doCheck ? true +, doDevelopInstall ? true }: let - - # Convert vcsserverPath to absolute path. - vcsserverAbsPath = - if pkgs.lib.strings.hasPrefix "/" vcsserverPath then - builtins.toPath "${vcsserverPath}" - else - builtins.toPath ("${builtins.getEnv "PWD"}/${vcsserverPath}"); - - # Import vcsserver if nix file exists, otherwise set it to null. - vcsserver = - let - nixFile = "${vcsserverAbsPath}/${vcsserverNix}"; - in - if pkgs.lib.pathExists "${nixFile}" then - builtins.trace - "Using local vcsserver from ${nixFile}" - import "${nixFile}" {inherit pkgs;} - else - null; - - hasVcsserver = !isNull vcsserver; + sources = pkgs.config.rc.sources or {}; enterprise-ce = import ./default.nix { - inherit pkgs doCheck; + inherit pkgs pythonPackages doCheck; }; ce-pythonPackages = enterprise-ce.pythonPackages; @@ -73,7 +53,7 @@ in enterprise-ce.override (attrs: { buildInputs = attrs.buildInputs ++ - pkgs.lib.optionals (hasVcsserver) vcsserver.propagatedNativeBuildInputs ++ + pkgs.lib.lists.concatMap optionalDevelopInstallBuildInputs developInstalls ++ (with ce-pythonPackages; [ bumpversion invoke @@ -83,21 +63,19 @@ in enterprise-ce.override (attrs: { # Somewhat snappier setup of the development environment # TODO: think of supporting a stable path again, so that multiple shells # can share it. - postShellHook = '' + preShellHook = enterprise-ce.linkNodeAndBowerPackages + '' # Custom prompt to distinguish from other dev envs. export PS1="\n\[\033[1;32m\][CE-shell:\w]$\[\033[0m\] " + # Setup a temporary directory. tmp_path=$(mktemp -d) export PATH="$tmp_path/bin:$PATH" export PYTHONPATH="$tmp_path/${ce-pythonPackages.python.sitePackages}:$PYTHONPATH" mkdir -p $tmp_path/${ce-pythonPackages.python.sitePackages} + + # Develop installations python setup.py develop --prefix $tmp_path --allow-hosts "" - '' + enterprise-ce.linkNodeAndBowerPackages + - pkgs.lib.strings.optionalString (hasVcsserver) '' - # Setup the vcsserver development egg. - pushd ${vcsserverAbsPath} - python setup.py develop --prefix $tmp_path --allow-hosts "" - popd - ''; + echo "Additional develop installs" + '' + pkgs.lib.strings.concatMapStrings optionalDevelopInstall developInstalls; })