##// END OF EJS Templates
nix: Add `sourcesOverrides` argument to shell.nix to set the vcs server path in jenkins.
Martin Bornhold -
r1133:69363678 default
parent child Browse files
Show More
@@ -1,81 +1,83 b''
1 1 { pkgs ? (import <nixpkgs> {})
2 2 , pythonPackages ? "python27Packages"
3 3 , doCheck ? true
4 , sourcesOverrides ? {}
4 5 , doDevelopInstall ? true
5 6 }:
6 7
7 8 let
8 sources = pkgs.config.rc.sources or {};
9 # Get sources from config and update them with overrides.
10 sources = (pkgs.config.rc.sources or {}) // sourcesOverrides;
9 11
10 12 enterprise-ce = import ./default.nix {
11 13 inherit pkgs pythonPackages doCheck;
12 14 };
13 15
14 16 ce-pythonPackages = enterprise-ce.pythonPackages;
15 17
16 18 # This method looks up a path from `pkgs.config.rc.sources` and returns a
17 19 # shell script which does a `python setup.py develop` installation of it. If
18 20 # no path is found it will return an empty string.
19 21 optionalDevelopInstall = attributeName:
20 22 let
21 23 path = pkgs.lib.attrByPath [attributeName] null sources;
22 24 doIt = doDevelopInstall && path != null;
23 25 in
24 26 pkgs.lib.optionalString doIt (
25 27 builtins.trace "Develop install of ${attributeName} from ${path}" ''
26 28 echo "Develop install of '${attributeName}' from '${path}' [BEGIN]"
27 29 pushd ${path}
28 30 python setup.py develop --prefix $tmp_path --allow-hosts ""
29 31 popd
30 32 echo "Develop install of '${attributeName}' from '${path}' [DONE]"
31 33 '');
32 34
33 35 # This method looks up a path from `pkgs.config.rc.sources` and imports the
34 36 # default.nix file if it exists. It returns the list of build inputs. If no
35 37 # path is found it will return an empty list.
36 38 optionalDevelopInstallBuildInputs = attributeName:
37 39 let
38 40 path = pkgs.lib.attrByPath [attributeName] null sources;
39 41 nixFile = "${path}/default.nix";
40 42 doIt = doDevelopInstall && path != null && pkgs.lib.pathExists "${nixFile}";
41 43 derivate = import "${nixFile}" {
42 44 inherit doCheck pkgs pythonPackages;
43 45 };
44 46 in
45 47 pkgs.lib.lists.optionals doIt derivate.propagatedNativeBuildInputs;
46 48
47 49 developInstalls = [ "rhodecode-vcsserver" ];
48 50
49 51 in enterprise-ce.override (attrs: {
50 52 # Avoid that we dump any sources into the store when entering the shell and
51 53 # make development a little bit more convenient.
52 54 src = null;
53 55
54 56 buildInputs =
55 57 attrs.buildInputs ++
56 58 pkgs.lib.lists.concatMap optionalDevelopInstallBuildInputs developInstalls ++
57 59 (with ce-pythonPackages; [
58 60 bumpversion
59 61 invoke
60 62 ipdb
61 63 ]);
62 64
63 65 # Somewhat snappier setup of the development environment
64 66 # TODO: think of supporting a stable path again, so that multiple shells
65 67 # can share it.
66 68 preShellHook = enterprise-ce.linkNodeAndBowerPackages + ''
67 69 # Custom prompt to distinguish from other dev envs.
68 70 export PS1="\n\[\033[1;32m\][CE-shell:\w]$\[\033[0m\] "
69 71
70 72 # Setup a temporary directory.
71 73 tmp_path=$(mktemp -d)
72 74 export PATH="$tmp_path/bin:$PATH"
73 75 export PYTHONPATH="$tmp_path/${ce-pythonPackages.python.sitePackages}:$PYTHONPATH"
74 76 mkdir -p $tmp_path/${ce-pythonPackages.python.sitePackages}
75 77
76 78 # Develop installations
77 79 python setup.py develop --prefix $tmp_path --allow-hosts ""
78 80 echo "Additional develop installs"
79 81 '' + pkgs.lib.strings.concatMapStrings optionalDevelopInstall developInstalls;
80 82
81 83 })
General Comments 0
You need to be logged in to leave comments. Login now