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