Show More
@@ -1,208 +1,208 b'' | |||
|
1 | 1 | # Nix environment for the community edition |
|
2 | 2 | # |
|
3 | 3 | # This shall be as lean as possible, just producing the rhodecode-vcsserver |
|
4 | 4 | # derivation. For advanced tweaks to pimp up the development environment we use |
|
5 | 5 | # "shell.nix" so that it does not have to clutter this file. |
|
6 | 6 | |
|
7 | 7 | args@ |
|
8 | 8 | { system ? builtins.currentSystem |
|
9 | 9 | , pythonPackages ? "python27Packages" |
|
10 | 10 | , pythonExternalOverrides ? self: super: {} |
|
11 | 11 | , doCheck ? false |
|
12 | 12 | , ... |
|
13 | 13 | }: |
|
14 | 14 | |
|
15 | 15 | let |
|
16 | 16 | pkgs_ = args.pkgs or (import <nixpkgs> { inherit system; }); |
|
17 | 17 | in |
|
18 | 18 | |
|
19 | 19 | let |
|
20 | 20 | pkgs = import <nixpkgs> { |
|
21 | 21 | overlays = [ |
|
22 | 22 | (import ./pkgs/overlays.nix) |
|
23 | 23 | ]; |
|
24 | 24 | inherit |
|
25 | 25 | (pkgs_) |
|
26 | 26 | system; |
|
27 | 27 | }; |
|
28 | 28 | |
|
29 | 29 | # Works with the new python-packages, still can fallback to the old |
|
30 | 30 | # variant. |
|
31 | 31 | basePythonPackagesUnfix = basePythonPackages.__unfix__ or ( |
|
32 | 32 | self: basePythonPackages.override (a: { inherit self; })); |
|
33 | 33 | |
|
34 | 34 | # Evaluates to the last segment of a file system path. |
|
35 | 35 | basename = path: with pkgs.lib; last (splitString "/" path); |
|
36 | 36 | startsWith = prefix: full: let |
|
37 | 37 | actualPrefix = builtins.substring 0 (builtins.stringLength prefix) full; |
|
38 | 38 | in actualPrefix == prefix; |
|
39 | 39 | |
|
40 | 40 | # source code filter used as arugment to builtins.filterSource. |
|
41 | 41 | src-filter = path: type: with pkgs.lib; |
|
42 | 42 | let |
|
43 | 43 | ext = last (splitString "." path); |
|
44 | 44 | parts = last (splitString "/" path); |
|
45 | 45 | in |
|
46 | 46 | !builtins.elem (basename path) [ |
|
47 | 47 | ".git" ".hg" "__pycache__" ".eggs" ".idea" ".dev" |
|
48 | 48 | "node_modules" "node_binaries" |
|
49 | 49 | "build" "data" "result" "tmp"] && |
|
50 | 50 | !builtins.elem ext ["egg-info" "pyc"] && |
|
51 | 51 | !startsWith "result" (basename path); |
|
52 | 52 | |
|
53 | 53 | sources = |
|
54 | 54 | let |
|
55 | 55 | inherit |
|
56 | 56 | (pkgs.lib) |
|
57 | 57 | all |
|
58 | 58 | isString |
|
59 | 59 | attrValues; |
|
60 | 60 | |
|
61 | 61 | sourcesConfig = pkgs.config.rc.sources or {}; |
|
62 | 62 | in |
|
63 | 63 | # Ensure that sources are configured as strings. Using a path |
|
64 | 64 | # would result in a copy into the nix store. |
|
65 | 65 | assert all isString (attrValues sourcesConfig); |
|
66 | 66 | sourcesConfig; |
|
67 | 67 | |
|
68 | 68 | version = builtins.readFile "${rhodecode-vcsserver-src}/vcsserver/VERSION"; |
|
69 | 69 | rhodecode-vcsserver-src = builtins.filterSource src-filter ./.; |
|
70 | 70 | |
|
71 | 71 | pythonLocalOverrides = self: super: { |
|
72 | 72 | rhodecode-vcsserver = |
|
73 | 73 | let |
|
74 | 74 | releaseName = "RhodeCodeVCSServer-${version}"; |
|
75 | 75 | in super.rhodecode-vcsserver.override (attrs: { |
|
76 | 76 | inherit |
|
77 | 77 | doCheck |
|
78 | 78 | version; |
|
79 | 79 | |
|
80 | 80 | name = "rhodecode-vcsserver-${version}"; |
|
81 | 81 | releaseName = releaseName; |
|
82 | 82 | src = rhodecode-vcsserver-src; |
|
83 | 83 | dontStrip = true; # prevent strip, we don't need it. |
|
84 | 84 | |
|
85 | 85 | # expose following attributed outside |
|
86 | 86 | passthru = { |
|
87 | 87 | pythonPackages = self; |
|
88 | 88 | vcs_pkgs = pkgs; |
|
89 | 89 | }; |
|
90 | 90 | |
|
91 | 91 | buildInputs = |
|
92 | 92 | attrs.buildInputs or [] ++ [ |
|
93 | 93 | |
|
94 | 94 | ]; |
|
95 | 95 | |
|
96 | 96 | #NOTE: option to inject additional propagatedBuildInputs |
|
97 | 97 | propagatedBuildInputs = |
|
98 | 98 | attrs.propagatedBuildInputs or [] ++ [ |
|
99 | 99 | pkgs.git |
|
100 | 100 | pkgs.subversion |
|
101 | 101 | ]; |
|
102 | 102 | |
|
103 | 103 | preBuild = '' |
|
104 | 104 | export NIX_PATH=nixpkgs=${pkgs.path} |
|
105 | 105 | export SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt |
|
106 | 106 | ''; |
|
107 | 107 | |
|
108 | 108 | # Add bin directory to path so that tests can find 'vcsserver'. |
|
109 | 109 | preCheck = '' |
|
110 | 110 | export PATH="$out/bin:$PATH" |
|
111 | 111 | ''; |
|
112 | 112 | |
|
113 | 113 | # custom check phase for testing |
|
114 | 114 | checkPhase = '' |
|
115 | 115 | runHook preCheck |
|
116 | 116 | PYTHONHASHSEED=random py.test -vv -p no:sugar -r xw --cov-config=.coveragerc --cov=vcsserver --cov-report=term-missing vcsserver |
|
117 | 117 | runHook postCheck |
|
118 | 118 | ''; |
|
119 | 119 | |
|
120 | 120 | postCheck = '' |
|
121 | 121 | echo "Cleanup of vcsserver/tests" |
|
122 | 122 | rm -rf $out/lib/${self.python.libPrefix}/site-packages/vcsserver/tests |
|
123 | 123 | ''; |
|
124 | 124 | |
|
125 | 125 | postInstall = '' |
|
126 | 126 | echo "Writing vcsserver meta information for rccontrol to nix-support/rccontrol" |
|
127 | 127 | mkdir -p $out/nix-support/rccontrol |
|
128 | 128 | cp -v vcsserver/VERSION $out/nix-support/rccontrol/version |
|
129 | 129 | echo "DONE: vcsserver meta information for rccontrol written" |
|
130 | 130 | |
|
131 | 131 | mkdir -p $out/etc |
|
132 | 132 | cp configs/production.ini $out/etc |
|
133 | 133 | echo "DONE: saved vcsserver production.ini into $out/etc" |
|
134 | 134 | |
|
135 | 135 | echo "saving env in $out/etc/env_vars.txt" |
|
136 | 136 | touch $out/etc/env_vars.txt |
|
137 | 137 | echo "# RhodeCode build env vars" >> $out/etc/env_vars.txt |
|
138 | 138 | echo "LOCALE_ARCHIVE=\"${pkgs.glibcLocales}/lib/locale/locale-archive\"" >> $out/etc/env_vars.txt |
|
139 | 139 | echo "LC_ALL=\"en_US.UTF-8\"" >> $out/etc/env_vars.txt |
|
140 | 140 | |
|
141 | 141 | # python based programs need to be wrapped |
|
142 | 142 | mkdir -p $out/bin |
|
143 | 143 | |
|
144 | 144 | # expose python |
|
145 |
ln -s ${s |
|
|
145 | ln -s ${pkgs.pythonWithSetuptools}/bin/python $out/bin/ | |
|
146 | 146 | |
|
147 | 147 | # required binaries from dependencies |
|
148 | 148 | ln -s ${self.gunicorn}/bin/gunicorn $out/bin/ |
|
149 | 149 | ln -s ${self.pyramid}/bin/prequest $out/bin/ |
|
150 | 150 | ln -s ${self.pyramid}/bin/pserve $out/bin/ |
|
151 | 151 | |
|
152 | 152 | # Symlink version control utilities |
|
153 | 153 | # We ensure that always the correct version is available as a symlink. |
|
154 | 154 | # So that users calling them via the profile path will always use the |
|
155 | 155 | # correct version. Wrapping is required so those can "import" |
|
156 | 156 | # vcsserver python hooks. |
|
157 | 157 | |
|
158 | 158 | ln -s ${pkgs.git}/bin/git $out/bin |
|
159 | 159 | ln -s ${self.mercurial}/bin/hg $out/bin |
|
160 | 160 | ln -s ${pkgs.subversion}/bin/svn* $out/bin |
|
161 | 161 | |
|
162 | 162 | echo "DONE: created symlinks into $out/bin" |
|
163 | 163 | DEPS="$out/bin/*" |
|
164 | 164 | |
|
165 | 165 | # wrap only dependency scripts, they require to have full PYTHONPATH set |
|
166 | 166 | # to be able to import all packages |
|
167 | 167 | for file in $DEPS; |
|
168 | 168 | do |
|
169 | 169 | wrapProgram $file \ |
|
170 | 170 | --prefix PATH : $PATH \ |
|
171 | 171 | --prefix PYTHONPATH : $PYTHONPATH \ |
|
172 | 172 | --set PYTHONHASHSEED random |
|
173 | 173 | done |
|
174 | 174 | |
|
175 | 175 | echo "DONE: vcsserver binary wrapping" |
|
176 | 176 | |
|
177 | 177 | ''; |
|
178 | 178 | |
|
179 | 179 | }); |
|
180 | 180 | }; |
|
181 | 181 | |
|
182 | 182 | |
|
183 | 183 | basePythonPackages = with builtins; |
|
184 | 184 | if isAttrs pythonPackages then |
|
185 | 185 | pythonPackages |
|
186 | 186 | else |
|
187 | 187 | getAttr pythonPackages pkgs; |
|
188 | 188 | |
|
189 | 189 | pythonGeneratedPackages = import ./pkgs/python-packages.nix { |
|
190 | 190 | inherit pkgs; |
|
191 | 191 | inherit (pkgs) fetchurl fetchgit fetchhg; |
|
192 | 192 | }; |
|
193 | 193 | |
|
194 | 194 | pythonVCSServerOverrides = import ./pkgs/python-packages-overrides.nix { |
|
195 | 195 | inherit pkgs basePythonPackages; |
|
196 | 196 | }; |
|
197 | 197 | |
|
198 | 198 | # Apply all overrides and fix the final package set |
|
199 | 199 | myPythonPackagesUnfix = with pkgs.lib; |
|
200 | 200 | (extends pythonExternalOverrides |
|
201 | 201 | (extends pythonLocalOverrides |
|
202 | 202 | (extends pythonVCSServerOverrides |
|
203 | 203 | (extends pythonGeneratedPackages |
|
204 | 204 | basePythonPackagesUnfix)))); |
|
205 | 205 | |
|
206 | 206 | myPythonPackages = (pkgs.lib.fix myPythonPackagesUnfix); |
|
207 | 207 | |
|
208 | 208 | in myPythonPackages.rhodecode-vcsserver |
@@ -1,17 +1,25 b'' | |||
|
1 | 1 | { pkgs |
|
2 | 2 | , pythonPackages |
|
3 | 3 | }: |
|
4 | 4 | |
|
5 | 5 | rec { |
|
6 | 6 | pip2nix-src = pkgs.fetchzip { |
|
7 | 7 | url = https://github.com/johbo/pip2nix/archive/51e6fdae34d0e8ded9efeef7a8601730249687a6.tar.gz; |
|
8 | 8 | sha256 = "02a4jjgi7lsvf8mhrxsd56s9a3yg20081rl9bgc2m84w60v2gbz2"; |
|
9 | 9 | }; |
|
10 | 10 | |
|
11 | 11 | pip2nix = import pip2nix-src { |
|
12 | 12 | inherit |
|
13 | 13 | pkgs |
|
14 | 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,72 +1,75 b'' | |||
|
1 | 1 | self: super: { |
|
2 | 2 | |
|
3 | pythonWithSetuptools = self.python.withPackages(ps: with ps; [ | |
|
4 | setuptools | |
|
5 | ]); | |
|
6 | ||
|
3 | 7 | # change GIT version |
|
4 | 8 | # latest supported are in: https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/version-management/git-and-tools/git |
|
5 | 9 | git = super.lib.overrideDerivation super.git (oldAttrs: { |
|
6 | 10 | name = "git-2.25.3"; |
|
7 | 11 | src = self.fetchurl { |
|
8 | 12 | url = "https://www.kernel.org/pub/software/scm/git/git-2.25.3.tar.xz"; |
|
9 | 13 | sha256 = "0yvr97cl0dvj3fwblq1mb0cp97v8hrn9l98p8b1jx8815mbsnz9h"; |
|
10 | 14 | }; |
|
11 | 15 | |
|
12 | 16 | # patches come from: https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/version-management/git-and-tools/git |
|
13 | 17 | patches = [ |
|
14 | 18 | ./patches/git/docbook2texi.patch |
|
15 | 19 | ./patches/git/git-sh-i18n.patch |
|
16 | 20 | ./patches/git/ssh-path.patch |
|
17 | 21 | ./patches/git/git-send-email-honor-PATH.patch |
|
18 | 22 | ./patches/git/installCheck-path.patch |
|
19 | 23 | ]; |
|
20 | 24 | |
|
21 | 25 | }); |
|
22 | 26 | |
|
23 | 27 | libgit2rc = super.lib.overrideDerivation super.libgit2 (oldAttrs: { |
|
24 | 28 | name = "libgit2-0.28.2"; |
|
25 | 29 | version = "0.28.2"; |
|
26 | 30 | |
|
27 | 31 | src = self.fetchFromGitHub { |
|
28 | 32 | owner = "libgit2"; |
|
29 | 33 | repo = "libgit2"; |
|
30 | 34 | rev = "v0.28.2"; |
|
31 | 35 | sha256 = "0cm8fvs05rj0baigs2133q5a0sm3pa234y8h6hmwhl2bz9xq3k4b"; |
|
32 | 36 | }; |
|
33 | 37 | |
|
34 | 38 | cmakeFlags = [ "-DTHREADSAFE=ON" "-DUSE_HTTPS=no"]; |
|
35 | 39 | |
|
36 | 40 | buildInputs = [ |
|
37 | 41 | super.zlib |
|
38 | 42 | super.libssh2 |
|
39 | 43 | super.openssl |
|
40 | 44 | super.curl |
|
41 | 45 | ]; |
|
42 | 46 | |
|
43 | 47 | |
|
44 | 48 | }); |
|
45 | 49 | |
|
46 | 50 | # Override subversion derivation to |
|
47 | 51 | # - activate python bindings |
|
48 | 52 | subversion = |
|
49 | 53 | let |
|
50 | 54 | subversionWithPython = super.subversion.override { |
|
51 | 55 | httpSupport = true; |
|
52 | 56 | pythonBindings = true; |
|
53 | 57 | python = self.python27Packages.python; |
|
54 | 58 | }; |
|
55 | 59 | in |
|
56 | 60 | super.lib.overrideDerivation subversionWithPython (oldAttrs: { |
|
57 | 61 | name = "subversion-1.13.0"; |
|
58 | 62 | src = self.fetchurl { |
|
59 | 63 | url = "https://archive.apache.org/dist/subversion/subversion-1.13.0.tar.gz"; |
|
60 | 64 | sha256 = "0cb9p7f5hg0l4k32hz8vmvy2r45igchq5sh4m366za5q0c649bfs"; |
|
61 | 65 | }; |
|
62 | 66 | |
|
63 | 67 | ## use internal lz4/utf8proc because it is stable and shipped with SVN |
|
64 | 68 | configureFlags = oldAttrs.configureFlags ++ [ |
|
65 | 69 | " --with-lz4=internal" |
|
66 | 70 | " --with-utf8proc=internal" |
|
67 | 71 | ]; |
|
68 | 72 | |
|
69 | 73 | }); |
|
70 | 74 | |
|
71 | ||
|
72 | 75 | } |
@@ -1,59 +1,60 b'' | |||
|
1 | 1 | { pkgs ? (import <nixpkgs> {}) |
|
2 | 2 | , pythonPackages ? "python27Packages" |
|
3 | 3 | }: |
|
4 | 4 | |
|
5 | 5 | with pkgs.lib; |
|
6 | 6 | |
|
7 | 7 | let |
|
8 | 8 | _pythonPackages = pythonPackages; |
|
9 | 9 | |
|
10 | 10 | in |
|
11 | 11 | |
|
12 | 12 | let |
|
13 | 13 | pythonPackages = getAttr _pythonPackages pkgs; |
|
14 | 14 | |
|
15 | 15 | pip2nix = import ./nix-common/pip2nix.nix { |
|
16 | 16 | inherit |
|
17 | 17 | pkgs |
|
18 | 18 | pythonPackages; |
|
19 | 19 | }; |
|
20 | 20 | |
|
21 | 21 | in |
|
22 | 22 | |
|
23 | 23 | pkgs.stdenv.mkDerivation { |
|
24 | 24 | name = "pip2nix-generated"; |
|
25 | 25 | |
|
26 | 26 | buildInputs = [ |
|
27 | 27 | # Allows to generate python packages |
|
28 | 28 | pip2nix.pip2nix |
|
29 | pythonPackages.pip-tools | |
|
29 | pip2nix.pip | |
|
30 | pip2nix.pip-tools | |
|
31 | ||
|
30 | 32 | # compile using ffi |
|
31 | 33 | pkgs.libffi |
|
32 | 34 | |
|
33 | 35 | pkgs.apr |
|
34 | 36 | pkgs.aprutil |
|
35 | 37 | ]; |
|
36 | 38 | |
|
37 | 39 | shellHook = '' |
|
38 | 40 | runHook preShellHook |
|
39 | 41 | echo "Setting SVN_* variables" |
|
40 | 42 | export SVN_LIBRARY_PATH=${pkgs.subversion}/lib |
|
41 | 43 | export SVN_HEADER_PATH=${pkgs.subversion.dev}/include |
|
42 | 44 | runHook postShellHook |
|
43 | 45 | ''; |
|
44 | 46 | |
|
45 | 47 | preShellHook = '' |
|
46 | 48 | echo "Starting Generate Shell" |
|
47 | 49 | # set unpack source date to 1980 to fix ZIP problems that does not support <1980 |
|
48 | 50 | export SOURCE_DATE_EPOCH=315532800 |
|
49 | 51 | export TMPDIR=/tmp |
|
50 | 52 | export LOCALE_ARCHIVE="${pkgs.glibcLocales}/lib/locale/locale-archive" |
|
51 | 53 | export LC_ALL="en_US.UTF-8" |
|
54 | export PYCURL_SSL_LIBRARY=openssl | |
|
52 | 55 | |
|
53 | 56 | # Custom prompt to distinguish from other dev envs. |
|
54 | 57 | export PS1="\n\[\033[1;32m\][pip2nix-generate-shell]$\[\033[0m\] " |
|
55 | 58 | |
|
56 | export PYCURL_SSL_LIBRARY=openssl | |
|
57 | ||
|
58 | 59 | ''; |
|
59 | 60 | } |
General Comments 0
You need to be logged in to leave comments.
Login now