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