nix: Add methods to support develop installations from config.

This commit is contained in:
Martin Bornhold 2016-10-17 09:32:13 +02:00
parent 5eb98d8151
commit d2d3673431

View file

@ -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.