##// END OF EJS Templates
nix: don't pass pkgs into injected vcsserver.
marcink -
r3144:5b719387 default
parent child Browse files
Show More
@@ -1,292 +1,293 b''
1 # Nix environment for the community edition
1 # Nix environment for the community edition
2 #
2 #
3 # This shall be as lean as possible, just producing the enterprise-ce
3 # This shall be as lean as possible, just producing the enterprise-ce
4 # derivation. For advanced tweaks to pimp up the development environment we use
4 # derivation. For advanced tweaks to pimp up the development environment we use
5 # "shell.nix" so that it does not have to clutter this file.
5 # "shell.nix" so that it does not have to clutter this file.
6 #
6 #
7 # Configuration, set values in "~/.nixpkgs/config.nix".
7 # Configuration, set values in "~/.nixpkgs/config.nix".
8 # example
8 # example
9 # {
9 # {
10 # # Thoughts on how to configure the dev environment
10 # # Thoughts on how to configure the dev environment
11 # rc = {
11 # rc = {
12 # codeInternalUrl = "https://usr:token@internal-code.rhodecode.com";
12 # codeInternalUrl = "https://usr:token@internal-code.rhodecode.com";
13 # sources = {
13 # sources = {
14 # rhodecode-vcsserver = "/home/user/work/rhodecode-vcsserver";
14 # rhodecode-vcsserver = "/home/user/work/rhodecode-vcsserver";
15 # rhodecode-enterprise-ce = "/home/user/work/rhodecode-enterprise-ce";
15 # rhodecode-enterprise-ce = "/home/user/work/rhodecode-enterprise-ce";
16 # rhodecode-enterprise-ee = "/home/user/work/rhodecode-enterprise-ee";
16 # rhodecode-enterprise-ee = "/home/user/work/rhodecode-enterprise-ee";
17 # };
17 # };
18 # };
18 # };
19 # }
19 # }
20
20
21 args@
21 args@
22 { pythonPackages ? "python27Packages"
22 { pythonPackages ? "python27Packages"
23 , pythonExternalOverrides ? self: super: {}
23 , pythonExternalOverrides ? self: super: {}
24 , doCheck ? false
24 , doCheck ? false
25 , ...
25 , ...
26 }:
26 }:
27 let pkgs_ = (import <nixpkgs> {}); in
27 let pkgs_ = (import <nixpkgs> {}); in
28
28
29 let
29 let
30 # Use nixpkgs from args or import them. We use this indirect approach
30 # Use nixpkgs from args or import them. We use this indirect approach
31 # through args to be able to use the name `pkgs` for our customized packages.
31 # through args to be able to use the name `pkgs` for our customized packages.
32 # Otherwise we will end up with an infinite recursion.
32 # Otherwise we will end up with an infinite recursion.
33 pkgs = args.pkgs or (import <nixpkgs> {
33 pkgs = args.pkgs or (import <nixpkgs> {
34 overlays = [
34 overlays = [
35 (import ./pkgs/overlays.nix)
35 (import ./pkgs/overlays.nix)
36 ];
36 ];
37 inherit (pkgs_)
37 inherit
38 (pkgs_)
38 system;
39 system;
39 });
40 });
40
41
41 # Works with the new python-packages, still can fallback to the old
42 # Works with the new python-packages, still can fallback to the old
42 # variant.
43 # variant.
43 basePythonPackagesUnfix = basePythonPackages.__unfix__ or (
44 basePythonPackagesUnfix = basePythonPackages.__unfix__ or (
44 self: basePythonPackages.override (a: { inherit self; }));
45 self: basePythonPackages.override (a: { inherit self; }));
45
46
46 # Evaluates to the last segment of a file system path.
47 # Evaluates to the last segment of a file system path.
47 basename = path: with pkgs.lib; last (splitString "/" path);
48 basename = path: with pkgs.lib; last (splitString "/" path);
48
49
49 # source code filter used as arugment to builtins.filterSource.
50 # source code filter used as arugment to builtins.filterSource.
50 src-filter = path: type: with pkgs.lib;
51 src-filter = path: type: with pkgs.lib;
51 let
52 let
52 ext = last (splitString "." path);
53 ext = last (splitString "." path);
53 in
54 in
54 !builtins.elem (basename path) [
55 !builtins.elem (basename path) [
55 ".git" ".hg" "__pycache__" ".eggs" ".idea" ".dev"
56 ".git" ".hg" "__pycache__" ".eggs" ".idea" ".dev"
56 "bower_components" "node_modules"
57 "bower_components" "node_modules"
57 "build" "data" "result" "tmp"] &&
58 "build" "data" "result" "tmp"] &&
58 !builtins.elem ext ["egg-info" "pyc"] &&
59 !builtins.elem ext ["egg-info" "pyc"] &&
59 # TODO: johbo: This check is wrong, since "path" contains an absolute path,
60 # TODO: johbo: This check is wrong, since "path" contains an absolute path,
60 # it would still be good to restore it since we want to ignore "result-*".
61 # it would still be good to restore it since we want to ignore "result-*".
61 !hasPrefix "result" path;
62 !hasPrefix "result" path;
62
63
63 sources =
64 sources =
64 let
65 let
65 inherit
66 inherit
66 (pkgs.lib)
67 (pkgs.lib)
67 all
68 all
68 isString
69 isString
69 attrValues;
70 attrValues;
70 sourcesConfig = pkgs.config.rc.sources or {};
71 sourcesConfig = pkgs.config.rc.sources or {};
71 in
72 in
72 # Ensure that sources are configured as strings. Using a path
73 # Ensure that sources are configured as strings. Using a path
73 # would result in a copy into the nix store.
74 # would result in a copy into the nix store.
74 assert all isString (attrValues sourcesConfig);
75 assert all isString (attrValues sourcesConfig);
75 sourcesConfig;
76 sourcesConfig;
76
77
77 version = builtins.readFile "${rhodecode-enterprise-ce-src}/rhodecode/VERSION";
78 version = builtins.readFile "${rhodecode-enterprise-ce-src}/rhodecode/VERSION";
78 rhodecode-enterprise-ce-src = builtins.filterSource src-filter ./.;
79 rhodecode-enterprise-ce-src = builtins.filterSource src-filter ./.;
79
80
80 buildBowerComponents = pkgs.buildBowerComponents;
81 buildBowerComponents = pkgs.buildBowerComponents;
81 nodeEnv = import ./pkgs/node-default.nix {
82 nodeEnv = import ./pkgs/node-default.nix {
82 inherit
83 inherit
83 pkgs;
84 pkgs;
84 };
85 };
85 nodeDependencies = nodeEnv.shell.nodeDependencies;
86 nodeDependencies = nodeEnv.shell.nodeDependencies;
86
87
87 bowerComponents = buildBowerComponents {
88 bowerComponents = buildBowerComponents {
88 name = "enterprise-ce-${version}";
89 name = "enterprise-ce-${version}";
89 generated = ./pkgs/bower-packages.nix;
90 generated = ./pkgs/bower-packages.nix;
90 src = rhodecode-enterprise-ce-src;
91 src = rhodecode-enterprise-ce-src;
91 };
92 };
92
93
93 rhodecode-testdata-src = sources.rhodecode-testdata or (
94 rhodecode-testdata-src = sources.rhodecode-testdata or (
94 pkgs.fetchhg {
95 pkgs.fetchhg {
95 url = "https://code.rhodecode.com/upstream/rc_testdata";
96 url = "https://code.rhodecode.com/upstream/rc_testdata";
96 rev = "v0.10.0";
97 rev = "v0.10.0";
97 sha256 = "0zn9swwvx4vgw4qn8q3ri26vvzgrxn15x6xnjrysi1bwmz01qjl0";
98 sha256 = "0zn9swwvx4vgw4qn8q3ri26vvzgrxn15x6xnjrysi1bwmz01qjl0";
98 });
99 });
99
100
100 rhodecode-testdata = import "${rhodecode-testdata-src}/default.nix" {
101 rhodecode-testdata = import "${rhodecode-testdata-src}/default.nix" {
101 inherit
102 inherit
102 doCheck
103 doCheck
103 pkgs
104 pkgs
104 pythonPackages;
105 pythonPackages;
105 };
106 };
106
107
107 pythonLocalOverrides = self: super: {
108 pythonLocalOverrides = self: super: {
108 rhodecode-enterprise-ce =
109 rhodecode-enterprise-ce =
109 let
110 let
110 linkNodeAndBowerPackages = ''
111 linkNodeAndBowerPackages = ''
111 export RHODECODE_CE_PATH=${rhodecode-enterprise-ce-src}
112 export RHODECODE_CE_PATH=${rhodecode-enterprise-ce-src}
112
113
113 echo "[BEGIN]: Link node packages"
114 echo "[BEGIN]: Link node packages"
114 rm -fr node_modules
115 rm -fr node_modules
115 mkdir node_modules
116 mkdir node_modules
116 # johbo: Linking individual packages allows us to run "npm install"
117 # johbo: Linking individual packages allows us to run "npm install"
117 # inside of a shell to try things out. Re-entering the shell will
118 # inside of a shell to try things out. Re-entering the shell will
118 # restore a clean environment.
119 # restore a clean environment.
119 ln -s ${nodeDependencies}/lib/node_modules/* node_modules/
120 ln -s ${nodeDependencies}/lib/node_modules/* node_modules/
120 echo "[DONE]: Link node packages"
121 echo "[DONE]: Link node packages"
121
122
122 echo "[BEGIN]: Link bower packages"
123 echo "[BEGIN]: Link bower packages"
123 rm -fr bower_components
124 rm -fr bower_components
124 mkdir bower_components
125 mkdir bower_components
125 ln -s ${bowerComponents}/bower_components/* bower_components/
126 ln -s ${bowerComponents}/bower_components/* bower_components/
126 echo "[DONE]: Link bower packages"
127 echo "[DONE]: Link bower packages"
127 '';
128 '';
128
129
129 releaseName = "RhodeCodeEnterpriseCE-${version}";
130 releaseName = "RhodeCodeEnterpriseCE-${version}";
130 in super.rhodecode-enterprise-ce.override (attrs: {
131 in super.rhodecode-enterprise-ce.override (attrs: {
131 inherit
132 inherit
132 doCheck
133 doCheck
133 version;
134 version;
134
135
135 name = "rhodecode-enterprise-ce-${version}";
136 name = "rhodecode-enterprise-ce-${version}";
136 releaseName = releaseName;
137 releaseName = releaseName;
137 src = rhodecode-enterprise-ce-src;
138 src = rhodecode-enterprise-ce-src;
138 dontStrip = true; # prevent strip, we don't need it.
139 dontStrip = true; # prevent strip, we don't need it.
139
140
140 # expose following attributed outside
141 # expose following attributed outside
141 passthru = {
142 passthru = {
142 inherit
143 inherit
143 rhodecode-testdata
144 rhodecode-testdata
144 bowerComponents
145 bowerComponents
145 linkNodeAndBowerPackages
146 linkNodeAndBowerPackages
146 myPythonPackagesUnfix
147 myPythonPackagesUnfix
147 pythonLocalOverrides
148 pythonLocalOverrides
148 pythonCommunityOverrides;
149 pythonCommunityOverrides;
149
150
150 pythonPackages = self;
151 pythonPackages = self;
151 };
152 };
152
153
153 buildInputs =
154 buildInputs =
154 attrs.buildInputs or [] ++ [
155 attrs.buildInputs or [] ++ [
155 rhodecode-testdata
156 rhodecode-testdata
156 pkgs.nodePackages.bower
157 pkgs.nodePackages.bower
157 pkgs.nodePackages.grunt-cli
158 pkgs.nodePackages.grunt-cli
158 ];
159 ];
159
160
160 #NOTE: option to inject additional propagatedBuildInputs
161 #NOTE: option to inject additional propagatedBuildInputs
161 propagatedBuildInputs =
162 propagatedBuildInputs =
162 attrs.propagatedBuildInputs or [] ++ [
163 attrs.propagatedBuildInputs or [] ++ [
163
164
164 ];
165 ];
165
166
166 LC_ALL = "en_US.UTF-8";
167 LC_ALL = "en_US.UTF-8";
167 LOCALE_ARCHIVE =
168 LOCALE_ARCHIVE =
168 if pkgs.stdenv.isLinux
169 if pkgs.stdenv.isLinux
169 then "${pkgs.glibcLocales}/lib/locale/locale-archive"
170 then "${pkgs.glibcLocales}/lib/locale/locale-archive"
170 else "";
171 else "";
171
172
172 # Add bin directory to path so that tests can find 'rhodecode'.
173 # Add bin directory to path so that tests can find 'rhodecode'.
173 preCheck = ''
174 preCheck = ''
174 export PATH="$out/bin:$PATH"
175 export PATH="$out/bin:$PATH"
175 '';
176 '';
176
177
177 # custom check phase for testing
178 # custom check phase for testing
178 checkPhase = ''
179 checkPhase = ''
179 runHook preCheck
180 runHook preCheck
180 PYTHONHASHSEED=random py.test -vv -p no:sugar -r xw --cov-config=.coveragerc --cov=rhodecode --cov-report=term-missing rhodecode
181 PYTHONHASHSEED=random py.test -vv -p no:sugar -r xw --cov-config=.coveragerc --cov=rhodecode --cov-report=term-missing rhodecode
181 runHook postCheck
182 runHook postCheck
182 '';
183 '';
183
184
184 postCheck = ''
185 postCheck = ''
185 echo "Cleanup of rhodecode/tests"
186 echo "Cleanup of rhodecode/tests"
186 rm -rf $out/lib/${self.python.libPrefix}/site-packages/rhodecode/tests
187 rm -rf $out/lib/${self.python.libPrefix}/site-packages/rhodecode/tests
187 '';
188 '';
188
189
189 preBuild = ''
190 preBuild = ''
190 echo "Building frontend assets"
191 echo "Building frontend assets"
191 ${linkNodeAndBowerPackages}
192 ${linkNodeAndBowerPackages}
192 grunt
193 grunt
193 rm -fr node_modules
194 rm -fr node_modules
194 '';
195 '';
195
196
196 postInstall = ''
197 postInstall = ''
197 # check required files
198 # check required files
198 if [ ! -f rhodecode/public/js/scripts.js ]; then
199 if [ ! -f rhodecode/public/js/scripts.js ]; then
199 echo "Missing scripts.js"
200 echo "Missing scripts.js"
200 exit 1
201 exit 1
201 fi
202 fi
202 if [ ! -f rhodecode/public/css/style.css ]; then
203 if [ ! -f rhodecode/public/css/style.css ]; then
203 echo "Missing style.css"
204 echo "Missing style.css"
204 exit 1
205 exit 1
205 fi
206 fi
206
207
207 echo "Writing enterprise-ce meta information for rccontrol to nix-support/rccontrol"
208 echo "Writing enterprise-ce meta information for rccontrol to nix-support/rccontrol"
208 mkdir -p $out/nix-support/rccontrol
209 mkdir -p $out/nix-support/rccontrol
209 cp -v rhodecode/VERSION $out/nix-support/rccontrol/version
210 cp -v rhodecode/VERSION $out/nix-support/rccontrol/version
210 echo "[DONE]: enterprise-ce meta information for rccontrol written"
211 echo "[DONE]: enterprise-ce meta information for rccontrol written"
211
212
212 mkdir -p $out/etc
213 mkdir -p $out/etc
213 cp configs/production.ini $out/etc
214 cp configs/production.ini $out/etc
214 echo "[DONE]: saved enterprise-ce production.ini into $out/etc"
215 echo "[DONE]: saved enterprise-ce production.ini into $out/etc"
215
216
216 cp -r rhodecode/config/rcextensions $out/etc/rcextensions.tmpl
217 cp -r rhodecode/config/rcextensions $out/etc/rcextensions.tmpl
217 echo "[DONE]: saved enterprise-ce rcextensions into $out/etc/rcextensions.tmpl"
218 echo "[DONE]: saved enterprise-ce rcextensions into $out/etc/rcextensions.tmpl"
218
219
219 # python based programs need to be wrapped
220 # python based programs need to be wrapped
220 mkdir -p $out/bin
221 mkdir -p $out/bin
221
222
222 # required binaries from dependencies
223 # required binaries from dependencies
223 ln -s ${self.supervisor}/bin/supervisorctl $out/bin/
224 ln -s ${self.supervisor}/bin/supervisorctl $out/bin/
224 ln -s ${self.supervisor}/bin/supervisord $out/bin/
225 ln -s ${self.supervisor}/bin/supervisord $out/bin/
225 ln -s ${self.pastescript}/bin/paster $out/bin/
226 ln -s ${self.pastescript}/bin/paster $out/bin/
226 ln -s ${self.channelstream}/bin/channelstream $out/bin/
227 ln -s ${self.channelstream}/bin/channelstream $out/bin/
227 ln -s ${self.celery}/bin/celery $out/bin/
228 ln -s ${self.celery}/bin/celery $out/bin/
228 ln -s ${self.gunicorn}/bin/gunicorn $out/bin/
229 ln -s ${self.gunicorn}/bin/gunicorn $out/bin/
229 ln -s ${self.pyramid}/bin/prequest $out/bin/
230 ln -s ${self.pyramid}/bin/prequest $out/bin/
230 ln -s ${self.pyramid}/bin/pserve $out/bin/
231 ln -s ${self.pyramid}/bin/pserve $out/bin/
231
232
232 echo "[DONE]: created symlinks into $out/bin"
233 echo "[DONE]: created symlinks into $out/bin"
233 DEPS="$out/bin/supervisorctl \
234 DEPS="$out/bin/supervisorctl \
234 $out/bin/supervisord \
235 $out/bin/supervisord \
235 $out/bin/paster \
236 $out/bin/paster \
236 $out/bin/channelstream \
237 $out/bin/channelstream \
237 $out/bin/celery \
238 $out/bin/celery \
238 $out/bin/gunicorn \
239 $out/bin/gunicorn \
239 $out/bin/prequest \
240 $out/bin/prequest \
240 $out/bin/pserve"
241 $out/bin/pserve"
241
242
242 # wrap only dependency scripts, they require to have full PYTHONPATH set
243 # wrap only dependency scripts, they require to have full PYTHONPATH set
243 # to be able to import all packages
244 # to be able to import all packages
244 for file in $DEPS;
245 for file in $DEPS;
245 do
246 do
246 wrapProgram $file \
247 wrapProgram $file \
247 --prefix PATH : $PATH \
248 --prefix PATH : $PATH \
248 --prefix PYTHONPATH : $PYTHONPATH \
249 --prefix PYTHONPATH : $PYTHONPATH \
249 --set PYTHONHASHSEED random
250 --set PYTHONHASHSEED random
250 done
251 done
251
252
252 echo "[DONE]: enterprise-ce binary wrapping"
253 echo "[DONE]: enterprise-ce binary wrapping"
253
254
254 # rhodecode-tools don't need wrapping
255 # rhodecode-tools don't need wrapping
255 ln -s ${self.rhodecode-tools}/bin/rhodecode-* $out/bin/
256 ln -s ${self.rhodecode-tools}/bin/rhodecode-* $out/bin/
256
257
257 '';
258 '';
258 });
259 });
259
260
260 };
261 };
261
262
262 basePythonPackages = with builtins;
263 basePythonPackages = with builtins;
263 if isAttrs pythonPackages then
264 if isAttrs pythonPackages then
264 pythonPackages
265 pythonPackages
265 else
266 else
266 getAttr pythonPackages pkgs;
267 getAttr pythonPackages pkgs;
267
268
268 pythonGeneratedPackages = import ./pkgs/python-packages.nix {
269 pythonGeneratedPackages = import ./pkgs/python-packages.nix {
269 inherit
270 inherit
270 pkgs;
271 pkgs;
271 inherit
272 inherit
272 (pkgs)
273 (pkgs)
273 fetchurl
274 fetchurl
274 fetchgit
275 fetchgit
275 fetchhg;
276 fetchhg;
276 };
277 };
277
278
278 pythonCommunityOverrides = import ./pkgs/python-packages-overrides.nix {
279 pythonCommunityOverrides = import ./pkgs/python-packages-overrides.nix {
279 inherit pkgs basePythonPackages;
280 inherit pkgs basePythonPackages;
280 };
281 };
281
282
282 # Apply all overrides and fix the final package set
283 # Apply all overrides and fix the final package set
283 myPythonPackagesUnfix = with pkgs.lib;
284 myPythonPackagesUnfix = with pkgs.lib;
284 (extends pythonExternalOverrides
285 (extends pythonExternalOverrides
285 (extends pythonLocalOverrides
286 (extends pythonLocalOverrides
286 (extends pythonCommunityOverrides
287 (extends pythonCommunityOverrides
287 (extends pythonGeneratedPackages
288 (extends pythonGeneratedPackages
288 basePythonPackagesUnfix))));
289 basePythonPackagesUnfix))));
289
290
290 myPythonPackages = (pkgs.lib.fix myPythonPackagesUnfix);
291 myPythonPackages = (pkgs.lib.fix myPythonPackagesUnfix);
291
292
292 in myPythonPackages.rhodecode-enterprise-ce
293 in myPythonPackages.rhodecode-enterprise-ce
@@ -1,118 +1,117 b''
1 # This file contains the adjustments which are desired for a development
1 # This file contains the adjustments which are desired for a development
2 # environment.
2 # environment.
3
3
4 { pkgs ? (import <nixpkgs> {})
4 { pkgs ? (import <nixpkgs> {})
5 , pythonPackages ? "python27Packages"
5 , pythonPackages ? "python27Packages"
6 , doCheck ? false
6 , doCheck ? false
7 , sourcesOverrides ? {}
7 , sourcesOverrides ? {}
8 , doDevelopInstall ? true
8 , doDevelopInstall ? true
9 }:
9 }:
10
10
11 let
11 let
12 # Get sources from config and update them with overrides.
12 # Get sources from config and update them with overrides.
13 sources = (pkgs.config.rc.sources or {}) // sourcesOverrides;
13 sources = (pkgs.config.rc.sources or {}) // sourcesOverrides;
14
14
15 enterprise-ce = import ./default.nix {
15 enterprise-ce = import ./default.nix {
16 inherit
16 inherit
17 pythonPackages
17 pythonPackages
18 doCheck;
18 doCheck;
19 };
19 };
20
20
21 ce-pythonPackages = enterprise-ce.pythonPackages;
21 ce-pythonPackages = enterprise-ce.pythonPackages;
22
22
23 # This method looks up a path from `pkgs.config.rc.sources` and returns a
23 # This method looks up a path from `pkgs.config.rc.sources` and returns a
24 # shell script which does a `python setup.py develop` installation of it. If
24 # shell script which does a `python setup.py develop` installation of it. If
25 # no path is found it will return an empty string.
25 # no path is found it will return an empty string.
26 optionalDevelopInstall = attributeName:
26 optionalDevelopInstall = attributeName:
27 let
27 let
28 path = pkgs.lib.attrByPath [attributeName] null sources;
28 path = pkgs.lib.attrByPath [attributeName] null sources;
29 doIt = doDevelopInstall && path != null;
29 doIt = doDevelopInstall && path != null;
30
30
31 in
31 in
32 # do develop installation with empty hosts to skip any package duplicates to
32 # do develop installation with empty hosts to skip any package duplicates to
33 # be replaced. This only pushes the package to be locally available
33 # be replaced. This only pushes the package to be locally available
34 pkgs.lib.optionalString doIt (''
34 pkgs.lib.optionalString doIt (''
35 echo "[BEGIN] Develop install of '${attributeName}' from '${path}'"
35 echo "[BEGIN] Develop install of '${attributeName}' from '${path}'"
36 pushd ${path}
36 pushd ${path}
37 python setup.py develop --prefix $tmp_path --allow-hosts ""
37 python setup.py develop --prefix $tmp_path --allow-hosts ""
38 popd
38 popd
39 echo "[DONE] Develop install of '${attributeName}' from '${path}'"
39 echo "[DONE] Develop install of '${attributeName}' from '${path}'"
40 echo ""
40 echo ""
41 '');
41 '');
42
42
43 # This method looks up a path from `pkgs.config.rc.sources` and imports the
43 # This method looks up a path from `pkgs.config.rc.sources` and imports the
44 # default.nix file if it exists. It returns the list of build inputs. If no
44 # default.nix file if it exists. It returns the list of build inputs. If no
45 # path is found it will return an empty list.
45 # path is found it will return an empty list.
46 optionalDevelopInstallBuildInputs = attributeName:
46 optionalDevelopInstallBuildInputs = attributeName:
47 let
47 let
48 path = pkgs.lib.attrByPath [attributeName] null sources;
48 path = pkgs.lib.attrByPath [attributeName] null sources;
49 doIt = doDevelopInstall && path != null && pkgs.lib.pathExists "${nixFile}";
49 doIt = doDevelopInstall && path != null && pkgs.lib.pathExists "${nixFile}";
50 nixFile = "${path}/default.nix";
50 nixFile = "${path}/default.nix";
51
51
52 derivate = import "${nixFile}" {
52 derivate = import "${nixFile}" {
53 inherit
53 inherit
54 doCheck
54 doCheck
55 pkgs
56 pythonPackages;
55 pythonPackages;
57 };
56 };
58 in
57 in
59 pkgs.lib.lists.optionals doIt (
58 pkgs.lib.lists.optionals doIt (
60 derivate.propagatedBuildInputs
59 derivate.propagatedBuildInputs
61 );
60 );
62
61
63 developInstalls = [ "rhodecode-vcsserver" ];
62 developInstalls = [ "rhodecode-vcsserver" ];
64
63
65 in enterprise-ce.override (attrs: {
64 in enterprise-ce.override (attrs: {
66 # Avoid that we dump any sources into the store when entering the shell and
65 # Avoid that we dump any sources into the store when entering the shell and
67 # make development a little bit more convenient.
66 # make development a little bit more convenient.
68 src = null;
67 src = null;
69
68
70 # Add dependencies which are useful for the development environment.
69 # Add dependencies which are useful for the development environment.
71 buildInputs =
70 buildInputs =
72 attrs.buildInputs ++
71 attrs.buildInputs ++
73 (with ce-pythonPackages; [
72 (with ce-pythonPackages; [
74 bumpversion
73 bumpversion
75 invoke
74 invoke
76 ipdb
75 ipdb
77 ]);
76 ]);
78
77
79 # place to inject some required libs from develop installs
78 # place to inject some required libs from develop installs
80 propagatedBuildInputs =
79 propagatedBuildInputs =
81 attrs.propagatedBuildInputs ++
80 attrs.propagatedBuildInputs ++
82 pkgs.lib.lists.concatMap optionalDevelopInstallBuildInputs developInstalls;
81 pkgs.lib.lists.concatMap optionalDevelopInstallBuildInputs developInstalls;
83
82
84
83
85 # Make sure we execute both hooks
84 # Make sure we execute both hooks
86 shellHook = ''
85 shellHook = ''
87 runHook preShellHook
86 runHook preShellHook
88 runHook postShellHook
87 runHook postShellHook
89 '';
88 '';
90
89
91 preShellHook = ''
90 preShellHook = ''
92 echo "Entering CE-Shell"
91 echo "Entering CE-Shell"
93
92
94 # Custom prompt to distinguish from other dev envs.
93 # Custom prompt to distinguish from other dev envs.
95 export PS1="\n\[\033[1;32m\][CE-shell:\w]$\[\033[0m\] "
94 export PS1="\n\[\033[1;32m\][CE-shell:\w]$\[\033[0m\] "
96
95
97 echo "Building frontend assets"
96 echo "Building frontend assets"
98 ${enterprise-ce.linkNodeAndBowerPackages}
97 ${enterprise-ce.linkNodeAndBowerPackages}
99
98
100 # Setup a temporary directory.
99 # Setup a temporary directory.
101 tmp_path=$(mktemp -d)
100 tmp_path=$(mktemp -d)
102 export PATH="$tmp_path/bin:$PATH"
101 export PATH="$tmp_path/bin:$PATH"
103 export PYTHONPATH="$tmp_path/${ce-pythonPackages.python.sitePackages}:$PYTHONPATH"
102 export PYTHONPATH="$tmp_path/${ce-pythonPackages.python.sitePackages}:$PYTHONPATH"
104 mkdir -p $tmp_path/${ce-pythonPackages.python.sitePackages}
103 mkdir -p $tmp_path/${ce-pythonPackages.python.sitePackages}
105
104
106 # Develop installation
105 # Develop installation
107 echo "[BEGIN]: develop install of rhodecode-enterprise-ce"
106 echo "[BEGIN]: develop install of rhodecode-enterprise-ce"
108 python setup.py develop --prefix $tmp_path --allow-hosts ""
107 python setup.py develop --prefix $tmp_path --allow-hosts ""
109 '';
108 '';
110
109
111 postShellHook = ''
110 postShellHook = ''
112 echo "** Additional develop installs **"
111 echo "** Additional develop installs **"
113 '' +
112 '' +
114 pkgs.lib.strings.concatMapStrings optionalDevelopInstall developInstalls
113 pkgs.lib.strings.concatMapStrings optionalDevelopInstall developInstalls
115 + ''
114 + ''
116 '';
115 '';
117
116
118 })
117 })
General Comments 0
You need to be logged in to leave comments. Login now