Added tag v4.18.0 for changeset f37a31265704
Added tag v4.18.0 for changeset f37a31265704

File last commit:

r4178:b87f1db7 default
r4183:d394ce60 stable
Show More
shell.nix
119 lines | 3.6 KiB | text/x-nix | NixLexer
nix: updated to 18.03 nix packages...
r2824 # This file contains the adjustments which are desired for a development
# environment.
project: added all source files and assets
r1 { pkgs ? (import <nixpkgs> {})
Martin Bornhold
nix: Use vcsserver from config instead of using command line argument.
r1132 , pythonPackages ? "python27Packages"
nix: updated to 18.03 nix packages...
r2824 , doCheck ? false
Martin Bornhold
nix: Add `sourcesOverrides` argument to shell.nix to set the vcs server path in jenkins.
r1133 , sourcesOverrides ? {}
Martin Bornhold
nix: Use vcsserver from config instead of using command line argument.
r1132 , doDevelopInstall ? true
nix: don't inject invoke/bumpversion in default shell, we use our own py3 compat, and want to have an option to skip it
r4178 , doReleaseInstall ? false
project: added all source files and assets
r1 }:
let
Martin Bornhold
nix: Add `sourcesOverrides` argument to shell.nix to set the vcs server path in jenkins.
r1133 # Get sources from config and update them with overrides.
sources = (pkgs.config.rc.sources or {}) // sourcesOverrides;
project: added all source files and assets
r1
Martin Bornhold
nix: Move shell hook: default.nix -> shell.nix and set custom prompt....
r1130 enterprise-ce = import ./default.nix {
nix: updated to 18.03 nix packages...
r2824 inherit
pythonPackages
doCheck;
project: added all source files and assets
r1 };
Martin Bornhold
nix: Move shell hook: default.nix -> shell.nix and set custom prompt....
r1130 ce-pythonPackages = enterprise-ce.pythonPackages;
project: added all source files and assets
r1
Martin Bornhold
nix: Add methods to support develop installations from config.
r1131 # 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;
nix: updated to 18.03 nix packages...
r2824
Martin Bornhold
nix: Add methods to support develop installations from config.
r1131 in
nix: updated to 18.03 nix packages...
r2824 # do develop installation with empty hosts to skip any package duplicates to
# be replaced. This only pushes the package to be locally available
pkgs.lib.optionalString doIt (''
echo "[BEGIN] Develop install of '${attributeName}' from '${path}'"
Martin Bornhold
nix: Add methods to support develop installations from config.
r1131 pushd ${path}
python setup.py develop --prefix $tmp_path --allow-hosts ""
popd
nix: updated to 18.03 nix packages...
r2824 echo "[DONE] Develop install of '${attributeName}' from '${path}'"
echo ""
Martin Bornhold
nix: Add methods to support develop installations from config.
r1131 '');
# 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;
nix: updated to 18.03 nix packages...
r2824 doIt = doDevelopInstall && path != null && pkgs.lib.pathExists "${nixFile}";
Martin Bornhold
nix: Add methods to support develop installations from config.
r1131 nixFile = "${path}/default.nix";
nix: updated to 18.03 nix packages...
r2824
Martin Bornhold
nix: Add methods to support develop installations from config.
r1131 derivate = import "${nixFile}" {
nix: use common formatting on inherit keyword.
r3143 inherit
doCheck
pythonPackages;
Martin Bornhold
nix: Add methods to support develop installations from config.
r1131 };
in
nix: updated to 18.03 nix packages...
r2824 pkgs.lib.lists.optionals doIt (
derivate.propagatedBuildInputs
);
Martin Bornhold
nix: Add methods to support develop installations from config.
r1131
developInstalls = [ "rhodecode-vcsserver" ];
Martin Bornhold
nix: Move shell hook: default.nix -> shell.nix and set custom prompt....
r1130 in enterprise-ce.override (attrs: {
project: added all source files and assets
r1 # Avoid that we dump any sources into the store when entering the shell and
# make development a little bit more convenient.
src = null;
nix: updated to 18.03 nix packages...
r2824 # Add dependencies which are useful for the development environment.
Martin Bornhold
dev-env: Improve build inputs formatting.
r433 buildInputs =
attrs.buildInputs ++
nix: don't inject invoke/bumpversion in default shell, we use our own py3 compat, and want to have an option to skip it
r4178 (with ce-pythonPackages;
[ ipdb ]
++ pkgs.lib.lists.optionals doReleaseInstall (
[invoke bumpversion]
)
);
project: added all source files and assets
r1
nix: updated to 18.03 nix packages...
r2824 # place to inject some required libs from develop installs
propagatedBuildInputs =
attrs.propagatedBuildInputs ++
pkgs.lib.lists.concatMap optionalDevelopInstallBuildInputs developInstalls;
# Make sure we execute both hooks
shellHook = ''
runHook preShellHook
runHook postShellHook
'';
preShellHook = ''
echo "Entering CE-Shell"
Martin Bornhold
nix: Move shell hook: default.nix -> shell.nix and set custom prompt....
r1130 # Custom prompt to distinguish from other dev envs.
export PS1="\n\[\033[1;32m\][CE-shell:\w]$\[\033[0m\] "
nix: updated to 18.03 nix packages...
r2824 echo "Building frontend assets"
packaging: dropped bower, it's now replaced by npm and webcomponents from polymer.
r3176 ${enterprise-ce.linkNodePackages}
nix: updated to 18.03 nix packages...
r2824
Martin Bornhold
nix: Use vcsserver from config instead of using command line argument.
r1132 # Setup a temporary directory.
Martin Bornhold
nix: Move shell hook: default.nix -> shell.nix and set custom prompt....
r1130 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}
Martin Bornhold
nix: Use vcsserver from config instead of using command line argument.
r1132
nix: updated to 18.03 nix packages...
r2824 # Develop installation
echo "[BEGIN]: develop install of rhodecode-enterprise-ce"
Martin Bornhold
nix: Move shell hook: default.nix -> shell.nix and set custom prompt....
r1130 python setup.py develop --prefix $tmp_path --allow-hosts ""
nix: updated to 18.03 nix packages...
r2824 '';
postShellHook = ''
echo "** Additional develop installs **"
'' +
pkgs.lib.strings.concatMapStrings optionalDevelopInstall developInstalls
+ ''
'';
Martin Bornhold
nix: Move shell hook: default.nix -> shell.nix and set custom prompt....
r1130
project: added all source files and assets
r1 })