Show More
@@ -1,295 +1,302 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@code.rhodecode.com/internal"; |
|
12 | # codeInternalUrl = "https://usr:token@code.rhodecode.com/internal"; | |
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 | { system ? builtins.currentSystem |
|
22 | { system ? builtins.currentSystem | |
23 | , pythonPackages ? "python27Packages" |
|
23 | , pythonPackages ? "python27Packages" | |
24 | , pythonExternalOverrides ? self: super: {} |
|
24 | , pythonExternalOverrides ? self: super: {} | |
25 | , doCheck ? false |
|
25 | , doCheck ? false | |
26 | , ... |
|
26 | , ... | |
27 | }: |
|
27 | }: | |
28 |
|
28 | |||
29 | let |
|
29 | let | |
30 | pkgs_ = args.pkgs or (import <nixpkgs> { inherit system; }); |
|
30 | pkgs_ = args.pkgs or (import <nixpkgs> { inherit system; }); | |
31 | in |
|
31 | in | |
32 |
|
32 | |||
33 | let |
|
33 | let | |
34 | pkgs = import <nixpkgs> { |
|
34 | pkgs = import <nixpkgs> { | |
35 | overlays = [ |
|
35 | overlays = [ | |
36 | (import ./pkgs/overlays.nix) |
|
36 | (import ./pkgs/overlays.nix) | |
37 | ]; |
|
37 | ]; | |
38 | inherit |
|
38 | inherit | |
39 | (pkgs_) |
|
39 | (pkgs_) | |
40 | system; |
|
40 | system; | |
41 | }; |
|
41 | }; | |
42 |
|
42 | |||
43 | # Works with the new python-packages, still can fallback to the old |
|
43 | # Works with the new python-packages, still can fallback to the old | |
44 | # variant. |
|
44 | # variant. | |
45 | basePythonPackagesUnfix = basePythonPackages.__unfix__ or ( |
|
45 | basePythonPackagesUnfix = basePythonPackages.__unfix__ or ( | |
46 | self: basePythonPackages.override (a: { inherit self; })); |
|
46 | self: basePythonPackages.override (a: { inherit self; })); | |
47 |
|
47 | |||
48 | # Evaluates to the last segment of a file system path. |
|
48 | # Evaluates to the last segment of a file system path. | |
49 | basename = path: with pkgs.lib; last (splitString "/" path); |
|
49 | basename = path: with pkgs.lib; last (splitString "/" path); | |
50 | startsWith = prefix: full: let |
|
50 | startsWith = prefix: full: let | |
51 | actualPrefix = builtins.substring 0 (builtins.stringLength prefix) full; |
|
51 | actualPrefix = builtins.substring 0 (builtins.stringLength prefix) full; | |
52 | in actualPrefix == prefix; |
|
52 | in actualPrefix == prefix; | |
53 |
|
53 | |||
54 | # source code filter used as arugment to builtins.filterSource. |
|
54 | # source code filter used as arugment to builtins.filterSource. | |
55 | src-filter = path: type: with pkgs.lib; |
|
55 | src-filter = path: type: with pkgs.lib; | |
56 | let |
|
56 | let | |
57 | ext = last (splitString "." path); |
|
57 | ext = last (splitString "." path); | |
58 | parts = last (splitString "/" path); |
|
58 | parts = last (splitString "/" path); | |
59 | in |
|
59 | in | |
60 | !builtins.elem (basename path) [ |
|
60 | !builtins.elem (basename path) [ | |
61 | ".git" ".hg" "__pycache__" ".eggs" ".idea" ".dev" |
|
61 | ".git" ".hg" "__pycache__" ".eggs" ".idea" ".dev" | |
62 | "node_modules" "node_binaries" |
|
62 | "node_modules" "node_binaries" | |
63 | "build" "data" "result" "tmp"] && |
|
63 | "build" "data" "result" "tmp"] && | |
64 | !builtins.elem ext ["egg-info" "pyc"] && |
|
64 | !builtins.elem ext ["egg-info" "pyc"] && | |
65 | !startsWith "result" (basename path); |
|
65 | !startsWith "result" (basename path); | |
66 |
|
66 | |||
67 | sources = |
|
67 | sources = | |
68 | let |
|
68 | let | |
69 | inherit |
|
69 | inherit | |
70 | (pkgs.lib) |
|
70 | (pkgs.lib) | |
71 | all |
|
71 | all | |
72 | isString |
|
72 | isString | |
73 | attrValues; |
|
73 | attrValues; | |
74 |
|
74 | |||
75 | sourcesConfig = pkgs.config.rc.sources or {}; |
|
75 | sourcesConfig = pkgs.config.rc.sources or {}; | |
76 | in |
|
76 | in | |
77 | # Ensure that sources are configured as strings. Using a path |
|
77 | # Ensure that sources are configured as strings. Using a path | |
78 | # would result in a copy into the nix store. |
|
78 | # would result in a copy into the nix store. | |
79 | assert all isString (attrValues sourcesConfig); |
|
79 | assert all isString (attrValues sourcesConfig); | |
80 | sourcesConfig; |
|
80 | sourcesConfig; | |
81 |
|
81 | |||
|
82 | rhodecode-enterprise-ce-src = builtins.filterSource src-filter ./.; | |||
82 | version = builtins.readFile "${rhodecode-enterprise-ce-src}/rhodecode/VERSION"; |
|
83 | version = builtins.readFile "${rhodecode-enterprise-ce-src}/rhodecode/VERSION"; | |
83 | rhodecode-enterprise-ce-src = builtins.filterSource src-filter ./.; |
|
|||
84 |
|
84 | |||
85 | nodeEnv = import ./pkgs/node-default.nix { |
|
85 | nodeEnv = import ./pkgs/node-default.nix { | |
86 | inherit |
|
86 | inherit | |
87 | pkgs |
|
87 | pkgs | |
88 | system; |
|
88 | system; | |
89 | }; |
|
89 | }; | |
90 | nodeDependencies = nodeEnv.shell.nodeDependencies; |
|
90 | nodeDependencies = nodeEnv.shell.nodeDependencies; | |
91 |
|
91 | |||
92 | rhodecode-testdata-src = sources.rhodecode-testdata or ( |
|
92 | rhodecode-testdata-src = sources.rhodecode-testdata or ( | |
93 | pkgs.fetchhg { |
|
93 | pkgs.fetchhg { | |
94 | url = "https://code.rhodecode.com/upstream/rc_testdata"; |
|
94 | url = "https://code.rhodecode.com/upstream/rc_testdata"; | |
95 | rev = "v0.10.0"; |
|
95 | rev = "v0.10.0"; | |
96 | sha256 = "0zn9swwvx4vgw4qn8q3ri26vvzgrxn15x6xnjrysi1bwmz01qjl0"; |
|
96 | sha256 = "0zn9swwvx4vgw4qn8q3ri26vvzgrxn15x6xnjrysi1bwmz01qjl0"; | |
97 | }); |
|
97 | }); | |
98 |
|
98 | |||
99 | rhodecode-testdata = import "${rhodecode-testdata-src}/default.nix" { |
|
99 | rhodecode-testdata = import "${rhodecode-testdata-src}/default.nix" { | |
100 | inherit |
|
100 | inherit | |
101 | doCheck |
|
101 | doCheck | |
102 | pkgs |
|
102 | pkgs | |
103 | pythonPackages; |
|
103 | pythonPackages; | |
104 | }; |
|
104 | }; | |
105 |
|
105 | |||
106 | pythonLocalOverrides = self: super: { |
|
106 | pythonLocalOverrides = self: super: { | |
107 | rhodecode-enterprise-ce = |
|
107 | rhodecode-enterprise-ce = | |
108 | let |
|
108 | let | |
109 | linkNodePackages = '' |
|
109 | linkNodePackages = '' | |
110 | export RHODECODE_CE_PATH=${rhodecode-enterprise-ce-src} |
|
110 | export RHODECODE_CE_PATH=${rhodecode-enterprise-ce-src} | |
111 |
|
111 | |||
112 | echo "[BEGIN]: Link node packages and binaries" |
|
112 | echo "[BEGIN]: Link node packages and binaries" | |
113 | # johbo: Linking individual packages allows us to run "npm install" |
|
113 | # johbo: Linking individual packages allows us to run "npm install" | |
114 | # inside of a shell to try things out. Re-entering the shell will |
|
114 | # inside of a shell to try things out. Re-entering the shell will | |
115 | # restore a clean environment. |
|
115 | # restore a clean environment. | |
116 | rm -fr node_modules |
|
116 | rm -fr node_modules | |
117 | mkdir node_modules |
|
117 | mkdir node_modules | |
118 | ln -s ${nodeDependencies}/lib/node_modules/* node_modules/ |
|
118 | ln -s ${nodeDependencies}/lib/node_modules/* node_modules/ | |
119 | export NODE_PATH=./node_modules |
|
119 | export NODE_PATH=./node_modules | |
120 |
|
120 | |||
121 | rm -fr node_binaries |
|
121 | rm -fr node_binaries | |
122 | mkdir node_binaries |
|
122 | mkdir node_binaries | |
123 | ln -s ${nodeDependencies}/bin/* node_binaries/ |
|
123 | ln -s ${nodeDependencies}/bin/* node_binaries/ | |
124 | echo "[DONE ]: Link node packages and binaries" |
|
124 | echo "[DONE ]: Link node packages and binaries" | |
125 | ''; |
|
125 | ''; | |
126 |
|
126 | |||
127 | releaseName = "RhodeCodeEnterpriseCE-${version}"; |
|
127 | releaseName = "RhodeCodeEnterpriseCE-${version}"; | |
|
128 | pythonWithEnv = | |||
|
129 | self.python.buildEnv.override { | |||
|
130 | extraLibs = [ ] ++ self.rhodecode-enterprise-ce.propagatedBuildInputs; | |||
|
131 | ignoreCollisions = true; | |||
|
132 | #--set PYTHONHASHSEED random TODO | |||
|
133 | }; | |||
128 | in super.rhodecode-enterprise-ce.override (attrs: { |
|
134 | in super.rhodecode-enterprise-ce.override (attrs: { | |
129 | inherit |
|
135 | inherit | |
130 | doCheck |
|
136 | doCheck | |
131 | version; |
|
137 | version; | |
132 |
|
138 | |||
133 | name = "rhodecode-enterprise-ce-${version}"; |
|
139 | name = "rhodecode-enterprise-ce-${version}"; | |
134 | releaseName = releaseName; |
|
140 | releaseName = releaseName; | |
135 | src = rhodecode-enterprise-ce-src; |
|
141 | src = rhodecode-enterprise-ce-src; | |
136 | dontStrip = true; # prevent strip, we don't need it. |
|
142 | dontStrip = true; # prevent strip, we don't need it. | |
137 |
|
143 | |||
138 | # expose following attributed outside |
|
144 | # expose following attributed outside | |
139 | passthru = { |
|
145 | passthru = { | |
140 | inherit |
|
146 | inherit | |
141 | rhodecode-testdata |
|
147 | rhodecode-testdata | |
142 | linkNodePackages |
|
148 | linkNodePackages | |
143 | myPythonPackagesUnfix |
|
149 | myPythonPackagesUnfix | |
144 | pythonLocalOverrides |
|
150 | pythonLocalOverrides | |
145 | pythonCommunityOverrides; |
|
151 | pythonCommunityOverrides; | |
146 |
|
152 | |||
147 | pythonPackages = self; |
|
153 | pythonPackages = self; | |
|
154 | rc_pkgs = pkgs; | |||
148 | }; |
|
155 | }; | |
149 |
|
156 | |||
150 | buildInputs = |
|
157 | buildInputs = | |
151 | attrs.buildInputs or [] ++ [ |
|
158 | attrs.buildInputs or [] ++ [ | |
152 | rhodecode-testdata |
|
159 | rhodecode-testdata | |
153 | ]; |
|
160 | ]; | |
154 |
|
161 | |||
155 | #NOTE: option to inject additional propagatedBuildInputs |
|
162 | #NOTE: option to inject additional propagatedBuildInputs | |
156 | propagatedBuildInputs = |
|
163 | propagatedBuildInputs = | |
157 | attrs.propagatedBuildInputs or [] ++ [ |
|
164 | attrs.propagatedBuildInputs or [] ++ [ | |
158 |
|
165 | |||
159 | ]; |
|
166 | ]; | |
160 |
|
167 | |||
161 | preBuild = '' |
|
168 | preBuild = '' | |
162 | export NIX_PATH=nixpkgs=${pkgs.path} |
|
169 | export NIX_PATH=nixpkgs=${pkgs.path} | |
163 | export SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt |
|
170 | export SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt | |
164 |
|
171 | |||
165 | echo "[BEGIN]: Building frontend assets" |
|
172 | echo "[BEGIN]: Building frontend assets" | |
166 | ${linkNodePackages} |
|
173 | ${linkNodePackages} | |
167 | make web-build |
|
174 | make web-build | |
168 | rm -fr node_modules |
|
175 | rm -fr node_modules | |
169 | rm -fr node_binaries |
|
176 | rm -fr node_binaries | |
170 | echo "[DONE ]: Building frontend assets" |
|
177 | echo "[DONE ]: Building frontend assets" | |
171 | ''; |
|
178 | ''; | |
172 |
|
179 | |||
173 | # Add bin directory to path so that tests can find 'rhodecode'. |
|
180 | # Add bin directory to path so that tests can find 'rhodecode'. | |
174 | preCheck = '' |
|
181 | preCheck = '' | |
175 | echo "Expanding PATH with $out/bin directory" |
|
182 | echo "Expanding PATH with $out/bin directory" | |
176 | export PATH="$out/bin:$PATH" |
|
183 | export PATH="$out/bin:$PATH" | |
177 | ''; |
|
184 | ''; | |
178 |
|
185 | |||
179 | # custom check phase for testing |
|
186 | # custom check phase for testing | |
180 | checkPhase = '' |
|
187 | checkPhase = '' | |
181 | runHook preCheck |
|
188 | runHook preCheck | |
182 | PYTHONHASHSEED=random py.test -vv -p no:sugar -r xw --cov-config=.coveragerc --cov=rhodecode --cov-report=term-missing rhodecode |
|
189 | PYTHONHASHSEED=random py.test -vv -p no:sugar -r xw --cov-config=.coveragerc --cov=rhodecode --cov-report=term-missing rhodecode | |
183 | runHook postCheck |
|
190 | runHook postCheck | |
184 | ''; |
|
191 | ''; | |
185 |
|
192 | |||
186 | postCheck = '' |
|
193 | postCheck = '' | |
187 | echo "Cleanup of rhodecode/tests" |
|
194 | echo "Cleanup of rhodecode/tests" | |
188 | rm -rf $out/lib/${self.python.libPrefix}/site-packages/rhodecode/tests |
|
195 | rm -rf $out/lib/${self.python.libPrefix}/site-packages/rhodecode/tests | |
189 | ''; |
|
196 | ''; | |
190 |
|
197 | |||
191 | postInstall = '' |
|
198 | postInstall = '' | |
192 | # check required files |
|
199 | # check required files | |
193 | STATIC_CHECK="/robots.txt /502.html |
|
200 | STATIC_CHECK="/robots.txt /502.html | |
194 | /js/scripts.min.js /js/rhodecode-components.js |
|
201 | /js/scripts.min.js /js/rhodecode-components.js | |
195 | /css/style.css /css/style-polymer.css /css/style-ipython.css" |
|
202 | /css/style.css /css/style-polymer.css /css/style-ipython.css" | |
196 |
|
203 | |||
197 | for file in $STATIC_CHECK; |
|
204 | for file in $STATIC_CHECK; | |
198 | do |
|
205 | do | |
199 | if [ ! -f rhodecode/public/$file ]; then |
|
206 | if [ ! -f rhodecode/public/$file ]; then | |
200 | echo "Missing $file" |
|
207 | echo "Missing $file" | |
201 | exit 1 |
|
208 | exit 1 | |
202 | fi |
|
209 | fi | |
203 | done |
|
210 | done | |
204 |
|
211 | |||
205 | echo "Writing enterprise-ce meta information for rccontrol to nix-support/rccontrol" |
|
212 | echo "Writing enterprise-ce meta information for rccontrol to nix-support/rccontrol" | |
206 | mkdir -p $out/nix-support/rccontrol |
|
213 | mkdir -p $out/nix-support/rccontrol | |
207 | cp -v rhodecode/VERSION $out/nix-support/rccontrol/version |
|
214 | cp -v rhodecode/VERSION $out/nix-support/rccontrol/version | |
208 | echo "[DONE ]: enterprise-ce meta information for rccontrol written" |
|
215 | echo "[DONE ]: enterprise-ce meta information for rccontrol written" | |
209 |
|
216 | |||
210 | mkdir -p $out/etc |
|
217 | mkdir -p $out/etc | |
211 | cp configs/production.ini $out/etc |
|
218 | cp configs/production.ini $out/etc | |
212 | echo "[DONE ]: saved enterprise-ce production.ini into $out/etc" |
|
219 | echo "[DONE ]: saved enterprise-ce production.ini into $out/etc" | |
213 |
|
220 | |||
|
221 | echo "saving env in $out/etc/env_vars.txt" | |||
|
222 | touch $out/etc/env_vars.txt | |||
|
223 | echo "# RhodeCode build env vars" >> $out/etc/env_vars.txt | |||
|
224 | echo "LOCALE_ARCHIVE=\"${pkgs.glibcLocales}/lib/locale/locale-archive\"" >> $out/etc/env_vars.txt | |||
|
225 | echo "LC_ALL=\"en_US.UTF-8\"" >> $out/etc/env_vars.txt | |||
|
226 | ||||
214 | cp -Rf rhodecode/config/rcextensions $out/etc/rcextensions.tmpl |
|
227 | cp -Rf rhodecode/config/rcextensions $out/etc/rcextensions.tmpl | |
215 | echo "[DONE ]: saved enterprise-ce rcextensions into $out/etc/rcextensions.tmpl" |
|
228 | echo "[DONE ]: saved enterprise-ce rcextensions into $out/etc/rcextensions.tmpl" | |
216 |
|
229 | |||
217 | # python based programs need to be wrapped |
|
230 | # python based programs need to be wrapped | |
218 | mkdir -p $out/bin |
|
231 | mkdir -p $out/bin | |
219 |
|
232 | |||
220 | # expose python |
|
233 | # expose python | |
221 |
ln -s ${ |
|
234 | ln -s ${pythonWithEnv}/bin/python $out/bin/ | |
222 |
|
235 | |||
223 | # required binaries from dependencies |
|
236 | # required binaries from dependencies | |
224 |
ln -s ${ |
|
237 | ln -s ${pythonWithEnv}/bin/supervisorctl $out/bin/ | |
225 |
ln -s ${ |
|
238 | ln -s ${pythonWithEnv}/bin/supervisord $out/bin/ | |
226 |
ln -s ${ |
|
239 | ln -s ${pythonWithEnv}/bin/paster $out/bin/ | |
227 |
ln -s ${ |
|
240 | ln -s ${pythonWithEnv}/bin/channelstream $out/bin/ | |
228 |
ln -s ${ |
|
241 | ln -s ${pythonWithEnv}/bin/celery $out/bin/ | |
229 |
ln -s ${ |
|
242 | ln -s ${pythonWithEnv}/bin/gunicorn $out/bin/ | |
230 |
ln -s ${ |
|
243 | ln -s ${pythonWithEnv}/bin/prequest $out/bin/ | |
231 |
ln -s ${ |
|
244 | ln -s ${pythonWithEnv}/bin/pserve $out/bin/ | |
232 |
|
245 | |||
233 | echo "[DONE ]: created symlinks into $out/bin" |
|
246 | echo "[DONE ]: created symlinks into $out/bin" | |
234 | DEPS="$out/bin/supervisorctl \ |
|
247 | DEPS=" | |
235 | $out/bin/supervisord \ |
|
248 | " | |
236 | $out/bin/paster \ |
|
|||
237 | $out/bin/channelstream \ |
|
|||
238 | $out/bin/celery \ |
|
|||
239 | $out/bin/gunicorn \ |
|
|||
240 | $out/bin/prequest \ |
|
|||
241 | $out/bin/pserve" |
|
|||
242 |
|
249 | |||
243 | # wrap only dependency scripts, they require to have full PYTHONPATH set |
|
250 | # wrap only dependency scripts, they require to have full PYTHONPATH set | |
244 | # to be able to import all packages |
|
251 | # to be able to import all packages | |
245 | for file in $DEPS; |
|
252 | for file in $DEPS; | |
246 | do |
|
253 | do | |
247 | wrapProgram $file \ |
|
254 | wrapProgram $file \ | |
248 | --prefix PATH : $PATH \ |
|
255 | --prefix PATH : $PATH \ | |
249 | --prefix PYTHONPATH : $PYTHONPATH \ |
|
256 | --prefix PYTHONPATH : $PYTHONPATH \ | |
250 | --set PYTHONHASHSEED random |
|
257 | --set PYTHONHASHSEED random | |
251 | done |
|
258 | done | |
252 |
|
259 | |||
253 | echo "[DONE ]: enterprise-ce binary wrapping" |
|
260 | echo "[DONE ]: enterprise-ce binary wrapping" | |
|
261 | ||||
254 | # rhodecode-tools don't need wrapping |
|
262 | # rhodecode-tools don't need wrapping | |
255 | ln -s ${self.rhodecode-tools}/bin/rhodecode-* $out/bin/ |
|
263 | ln -s ${self.rhodecode-tools}/bin/rhodecode-* $out/bin/ | |
256 |
|
264 | |||
257 | # expose sources of CE |
|
|||
258 | ln -s $out $out/etc/rhodecode_enterprise_ce_source |
|
|||
259 |
|
||||
260 | # expose static files folder |
|
265 | # expose static files folder | |
261 | cp -Rf $out/lib/${self.python.libPrefix}/site-packages/rhodecode/public/ $out/etc/static |
|
266 | cp -Rf $out/lib/${self.python.libPrefix}/site-packages/rhodecode/public/ $out/etc/static | |
262 | chmod 755 -R $out/etc/static |
|
267 | chmod 755 -R $out/etc/static | |
263 |
|
268 | |||
|
269 | # expose sources of rhodecode-enterprise-ce | |||
|
270 | ln -s $out $out/etc/rhodecode_enterprise_ce_source | |||
264 | ''; |
|
271 | ''; | |
265 |
|
272 | |||
266 | }); |
|
273 | }); | |
267 | }; |
|
274 | }; | |
268 |
|
275 | |||
269 |
|
276 | |||
270 | basePythonPackages = with builtins; |
|
277 | basePythonPackages = with builtins; | |
271 | if isAttrs pythonPackages then |
|
278 | if isAttrs pythonPackages then | |
272 | pythonPackages |
|
279 | pythonPackages | |
273 | else |
|
280 | else | |
274 | getAttr pythonPackages pkgs; |
|
281 | getAttr pythonPackages pkgs; | |
275 |
|
282 | |||
276 | pythonGeneratedPackages = import ./pkgs/python-packages.nix { |
|
283 | pythonGeneratedPackages = import ./pkgs/python-packages.nix { | |
277 | inherit pkgs; |
|
284 | inherit pkgs; | |
278 | inherit (pkgs) fetchurl fetchgit fetchhg; |
|
285 | inherit (pkgs) fetchurl fetchgit fetchhg; | |
279 | }; |
|
286 | }; | |
280 |
|
287 | |||
281 | pythonCommunityOverrides = import ./pkgs/python-packages-overrides.nix { |
|
288 | pythonCommunityOverrides = import ./pkgs/python-packages-overrides.nix { | |
282 | inherit pkgs basePythonPackages; |
|
289 | inherit pkgs basePythonPackages; | |
283 | }; |
|
290 | }; | |
284 |
|
291 | |||
285 | # Apply all overrides and fix the final package set |
|
292 | # Apply all overrides and fix the final package set | |
286 | myPythonPackagesUnfix = with pkgs.lib; |
|
293 | myPythonPackagesUnfix = with pkgs.lib; | |
287 | (extends pythonExternalOverrides |
|
294 | (extends pythonExternalOverrides | |
288 | (extends pythonLocalOverrides |
|
295 | (extends pythonLocalOverrides | |
289 | (extends pythonCommunityOverrides |
|
296 | (extends pythonCommunityOverrides | |
290 | (extends pythonGeneratedPackages |
|
297 | (extends pythonGeneratedPackages | |
291 | basePythonPackagesUnfix)))); |
|
298 | basePythonPackagesUnfix)))); | |
292 |
|
299 | |||
293 | myPythonPackages = (pkgs.lib.fix myPythonPackagesUnfix); |
|
300 | myPythonPackages = (pkgs.lib.fix myPythonPackagesUnfix); | |
294 |
|
301 | |||
295 | in myPythonPackages.rhodecode-enterprise-ce |
|
302 | in myPythonPackages.rhodecode-enterprise-ce |
@@ -1,17 +1,25 b'' | |||||
1 | { pkgs |
|
1 | { pkgs | |
2 | , pythonPackages |
|
2 | , pythonPackages | |
3 | }: |
|
3 | }: | |
4 |
|
4 | |||
5 | rec { |
|
5 | rec { | |
6 | pip2nix-src = pkgs.fetchzip { |
|
6 | pip2nix-src = pkgs.fetchzip { | |
7 | url = https://github.com/johbo/pip2nix/archive/51e6fdae34d0e8ded9efeef7a8601730249687a6.tar.gz; |
|
7 | url = https://github.com/johbo/pip2nix/archive/51e6fdae34d0e8ded9efeef7a8601730249687a6.tar.gz; | |
8 | sha256 = "02a4jjgi7lsvf8mhrxsd56s9a3yg20081rl9bgc2m84w60v2gbz2"; |
|
8 | sha256 = "02a4jjgi7lsvf8mhrxsd56s9a3yg20081rl9bgc2m84w60v2gbz2"; | |
9 | }; |
|
9 | }; | |
10 |
|
10 | |||
11 | pip2nix = import pip2nix-src { |
|
11 | pip2nix = import pip2nix-src { | |
12 | inherit |
|
12 | inherit | |
13 | pkgs |
|
13 | pkgs | |
14 | pythonPackages; |
|
14 | pythonPackages; | |
15 | }; |
|
15 | }; | |
16 |
|
16 | |||
|
17 | pip-tools = pythonPackages.pip-tools; | |||
|
18 | ||||
|
19 | setuptools = pythonPackages.setuptools; | |||
|
20 | ||||
|
21 | wheel = pythonPackages.wheel; | |||
|
22 | ||||
|
23 | pip = pythonPackages.pip; | |||
|
24 | ||||
17 | } |
|
25 | } |
@@ -1,71 +1,73 b'' | |||||
1 | { pkgs ? (import <nixpkgs> {}) |
|
1 | { pkgs ? (import <nixpkgs> {}) | |
2 | , pythonPackages ? "python27Packages" |
|
2 | , pythonPackages ? "python27Packages" | |
3 | }: |
|
3 | }: | |
4 |
|
4 | |||
5 | with pkgs.lib; |
|
5 | with pkgs.lib; | |
6 |
|
6 | |||
7 | let |
|
7 | let | |
8 | _pythonPackages = pythonPackages; |
|
8 | _pythonPackages = pythonPackages; | |
9 |
|
9 | |||
10 | in |
|
10 | in | |
11 |
|
11 | |||
12 | let |
|
12 | let | |
13 | pythonPackages = getAttr _pythonPackages pkgs; |
|
13 | pythonPackages = getAttr _pythonPackages pkgs; | |
14 |
|
14 | |||
15 | pip2nix = import ./nix-common/pip2nix.nix { |
|
15 | pip2nix = import ./nix-common/pip2nix.nix { | |
16 | inherit |
|
16 | inherit | |
17 | pkgs |
|
17 | pkgs | |
18 | pythonPackages; |
|
18 | pythonPackages; | |
19 | }; |
|
19 | }; | |
20 |
|
20 | |||
21 | in |
|
21 | in | |
22 |
|
22 | |||
23 | pkgs.stdenv.mkDerivation { |
|
23 | pkgs.stdenv.mkDerivation { | |
24 | name = "pip2nix-generated"; |
|
24 | name = "pip2nix-generated"; | |
25 |
|
25 | |||
26 | buildInputs = [ |
|
26 | buildInputs = [ | |
27 | # Allows to generate python packages |
|
27 | # Allows to generate python packages | |
28 | pip2nix.pip2nix |
|
28 | pip2nix.pip2nix | |
29 | pythonPackages.pip-tools |
|
29 | pip2nix.pip | |
|
30 | pip2nix.pip-tools | |||
|
31 | ||||
30 | # compile using ffi |
|
32 | # compile using ffi | |
31 | pkgs.libffi |
|
33 | pkgs.libffi | |
32 |
|
34 | |||
33 | pythonPackages.cython |
|
35 | pythonPackages.cython | |
34 |
|
36 | |||
35 | # Allows to generate node dependencies |
|
37 | # Allows to generate node dependencies | |
36 | pkgs.nodePackages.node2nix |
|
38 | pkgs.nodePackages.node2nix | |
37 |
|
39 | |||
38 | # We need mysql_config to be around |
|
40 | # We need mysql_config to be around | |
39 | pkgs.libmysqlclient |
|
41 | pkgs.libmysqlclient | |
40 |
|
42 | |||
41 | # We need postgresql to be around |
|
43 | # We need postgresql to be around | |
42 | pkgs.postgresql |
|
44 | pkgs.postgresql | |
43 |
|
45 | |||
44 | # we need the below for saml |
|
46 | # we need the below for saml | |
45 | pkgs.libxml2 |
|
47 | pkgs.libxml2 | |
46 | pkgs.libxslt |
|
48 | pkgs.libxslt | |
47 | pkgs.xmlsec |
|
49 | pkgs.xmlsec | |
48 |
|
50 | |||
49 | # Curl is needed for pycurl |
|
51 | # Curl is needed for pycurl | |
50 | pkgs.curl |
|
52 | pkgs.curl | |
51 | ]; |
|
53 | ]; | |
52 |
|
54 | |||
53 | shellHook = '' |
|
55 | shellHook = '' | |
54 | runHook preShellHook |
|
56 | runHook preShellHook | |
55 | runHook postShellHook |
|
57 | runHook postShellHook | |
56 | ''; |
|
58 | ''; | |
57 |
|
59 | |||
58 | preShellHook = '' |
|
60 | preShellHook = '' | |
59 | echo "Starting Generate Shell" |
|
61 | echo "Starting Generate Shell" | |
60 | # set unpack source date to 1980 to fix ZIP problems that does not support <1980 |
|
62 | # set unpack source date to 1980 to fix ZIP problems that does not support <1980 | |
61 | export SOURCE_DATE_EPOCH=315532800 |
|
63 | export SOURCE_DATE_EPOCH=315532800 | |
62 | export TMPDIR=/tmp |
|
64 | export TMPDIR=/tmp | |
63 | export LOCALE_ARCHIVE="${pkgs.glibcLocales}/lib/locale/locale-archive" |
|
65 | export LOCALE_ARCHIVE="${pkgs.glibcLocales}/lib/locale/locale-archive" | |
64 | export LC_ALL="en_US.UTF-8" |
|
66 | export LC_ALL="en_US.UTF-8" | |
|
67 | export PYCURL_SSL_LIBRARY=openssl | |||
|
68 | ||||
65 | # Custom prompt to distinguish from other dev envs. |
|
69 | # Custom prompt to distinguish from other dev envs. | |
66 | export PS1="\n\[\033[1;32m\][pip2nix-generate-shell]$\[\033[0m\] " |
|
70 | export PS1="\n\[\033[1;32m\][pip2nix-generate-shell]$\[\033[0m\] " | |
67 |
|
71 | |||
68 | export PYCURL_SSL_LIBRARY=openssl |
|
|||
69 |
|
||||
70 | ''; |
|
72 | ''; | |
71 | } |
|
73 | } |
General Comments 0
You need to be logged in to leave comments.
Login now