diff --git a/shell.nix b/shell.nix --- a/shell.nix +++ b/shell.nix @@ -33,6 +33,39 @@ let ce-pythonPackages = enterprise-ce.pythonPackages; + # This method looks up a path from `pkgs.config.rc.sources` and returns a + # shell script which does a `python setup.py develop` installation of it. If + # no path is found it will return an empty string. + optionalDevelopInstall = attributeName: + let + path = pkgs.lib.attrByPath [attributeName] null sources; + doIt = doDevelopInstall && path != null; + in + pkgs.lib.optionalString doIt ( + builtins.trace "Develop install of ${attributeName} from ${path}" '' + echo "Develop install of '${attributeName}' from '${path}' [BEGIN]" + pushd ${path} + python setup.py develop --prefix $tmp_path --allow-hosts "" + popd + echo "Develop install of '${attributeName}' from '${path}' [DONE]" + ''); + + # This method looks up a path from `pkgs.config.rc.sources` and imports the + # default.nix file if it exists. It returns the list of build inputs. If no + # path is found it will return an empty list. + optionalDevelopInstallBuildInputs = attributeName: + let + path = pkgs.lib.attrByPath [attributeName] null sources; + nixFile = "${path}/default.nix"; + doIt = doDevelopInstall && path != null && pkgs.lib.pathExists "${nixFile}"; + derivate = import "${nixFile}" { + inherit doCheck pkgs pythonPackages; + }; + in + pkgs.lib.lists.optionals doIt derivate.propagatedNativeBuildInputs; + + developInstalls = [ "rhodecode-vcsserver" ]; + in enterprise-ce.override (attrs: { # Avoid that we dump any sources into the store when entering the shell and # make development a little bit more convenient.