##// END OF EJS Templates
dependencies: Adding Bower out of nixpkgs...
johbo -
r709:a198b78f default
parent child Browse files
Show More
@@ -1,218 +1,219 b''
1 1 # Nix environment for the community edition
2 2 #
3 3 # This shall be as lean as possible, just producing the Enterprise
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 { pkgs ? (import <nixpkgs> {})
8 8 , pythonPackages ? "python27Packages"
9 9 , pythonExternalOverrides ? self: super: {}
10 10 , doCheck ? true
11 11 }:
12 12
13 13 let pkgs_ = pkgs; in
14 14
15 15 let
16 16 pkgs = pkgs_.overridePackages (self: super: {
17 17 # Override subversion derivation to
18 18 # - activate python bindings
19 19 # - set version to 1.8
20 20 subversion = super.subversion18.override {
21 21 httpSupport = true;
22 22 pythonBindings = true;
23 23 python = self.python27Packages.python;
24 24 };
25 25 });
26 26
27 27 inherit (pkgs.lib) fix extends;
28 28
29 29 basePythonPackages = with builtins; if isAttrs pythonPackages
30 30 then pythonPackages
31 31 else getAttr pythonPackages pkgs;
32 32
33 33 elem = builtins.elem;
34 34 basename = path: with pkgs.lib; last (splitString "/" path);
35 35 startsWith = prefix: full: let
36 36 actualPrefix = builtins.substring 0 (builtins.stringLength prefix) full;
37 37 in actualPrefix == prefix;
38 38
39 39 src-filter = path: type: with pkgs.lib;
40 40 let
41 41 ext = last (splitString "." path);
42 42 in
43 43 !elem (basename path) [
44 44 ".git" ".hg" "__pycache__" ".eggs" "node_modules"
45 45 "build" "data" "tmp"] &&
46 46 !elem ext ["egg-info" "pyc"] &&
47 47 !startsWith "result" path;
48 48
49 49 sources = pkgs.config.rc.sources or {};
50 50 rhodecode-enterprise-ce-src = builtins.filterSource src-filter ./.;
51 51
52 52 nodeEnv = import ./pkgs/node-default.nix {
53 53 inherit pkgs;
54 54 };
55 55 nodeDependencies = nodeEnv.shell.nodeDependencies;
56 56
57 57 pythonGeneratedPackages = self: basePythonPackages.override (a: {
58 58 inherit self;
59 59 })
60 60 // (scopedImport {
61 61 self = self;
62 62 super = basePythonPackages;
63 63 inherit pkgs;
64 64 inherit (pkgs) fetchurl fetchgit;
65 65 } ./pkgs/python-packages.nix);
66 66
67 67 pythonOverrides = import ./pkgs/python-packages-overrides.nix {
68 68 inherit
69 69 basePythonPackages
70 70 pkgs;
71 71 };
72 72
73 73 pythonLocalOverrides = self: super: {
74 74 rhodecode-enterprise-ce =
75 75 let
76 76 version = builtins.readFile ./rhodecode/VERSION;
77 77 linkNodeModules = ''
78 78 echo "Link node packages"
79 79 rm -fr node_modules
80 80 mkdir node_modules
81 81
82 82 # johbo: Linking individual packages allows us to run "npm install"
83 83 # inside of a shell to try things out. Re-entering the shell will
84 84 # restore a clean environment.
85 85 ln -s ${nodeDependencies}/lib/node_modules/* node_modules/
86 86
87 87 echo "DONE: Link node packages"
88 88 '';
89 89 in super.rhodecode-enterprise-ce.override (attrs: {
90 90
91 91 inherit
92 92 doCheck
93 93 version;
94 94 name = "rhodecode-enterprise-ce-${version}";
95 95 releaseName = "RhodeCodeEnterpriseCE-${version}";
96 96 src = rhodecode-enterprise-ce-src;
97 97
98 98 buildInputs =
99 99 attrs.buildInputs ++
100 100 (with self; [
101 pkgs.nodePackages.bower
101 102 pkgs.nodePackages.grunt-cli
102 103 pkgs.subversion
103 104 pytest-catchlog
104 105 rhodecode-testdata
105 106 ]);
106 107
107 108 propagatedBuildInputs = attrs.propagatedBuildInputs ++ (with self; [
108 109 rhodecode-tools
109 110 ]);
110 111
111 112 # TODO: johbo: Make a nicer way to expose the parts. Maybe
112 113 # pkgs/default.nix?
113 114 passthru = {
114 115 inherit
115 116 linkNodeModules
116 117 myPythonPackagesUnfix
117 118 pythonLocalOverrides;
118 119 pythonPackages = self;
119 120 };
120 121
121 122 LC_ALL = "en_US.UTF-8";
122 123 LOCALE_ARCHIVE =
123 124 if pkgs.stdenv ? glibc
124 125 then "${pkgs.glibcLocales}/lib/locale/locale-archive"
125 126 else "";
126 127
127 128 # Somewhat snappier setup of the development environment
128 129 # TODO: move into shell.nix
129 130 # TODO: think of supporting a stable path again, so that multiple shells
130 131 # can share it.
131 132 shellHook = ''
132 133 tmp_path=$(mktemp -d)
133 134 export PATH="$tmp_path/bin:$PATH"
134 135 export PYTHONPATH="$tmp_path/${self.python.sitePackages}:$PYTHONPATH"
135 136 mkdir -p $tmp_path/${self.python.sitePackages}
136 137 python setup.py develop --prefix $tmp_path --allow-hosts ""
137 138 '' + linkNodeModules;
138 139
139 140 preCheck = ''
140 141 export PATH="$out/bin:$PATH"
141 142 '';
142 143
143 144 postCheck = ''
144 145 rm -rf $out/lib/${self.python.libPrefix}/site-packages/pytest_pylons
145 146 rm -rf $out/lib/${self.python.libPrefix}/site-packages/rhodecode/tests
146 147 '';
147 148
148 149 preBuild = linkNodeModules + ''
149 150 grunt
150 151 rm -fr node_modules
151 152 '';
152 153
153 154 postInstall = ''
154 155 # python based programs need to be wrapped
155 156 ln -s ${self.supervisor}/bin/supervisor* $out/bin/
156 157 ln -s ${self.gunicorn}/bin/gunicorn $out/bin/
157 158 ln -s ${self.PasteScript}/bin/paster $out/bin/
158 159 ln -s ${self.channelstream}/bin/channelstream $out/bin/
159 160 ln -s ${self.pyramid}/bin/* $out/bin/ #*/
160 161
161 162 # rhodecode-tools
162 163 # TODO: johbo: re-think this. Do the tools import anything from enterprise?
163 164 ln -s ${self.rhodecode-tools}/bin/rhodecode-* $out/bin/
164 165
165 166 # note that condition should be restricted when adding further tools
166 167 for file in $out/bin/*; do #*/
167 168 wrapProgram $file \
168 169 --prefix PYTHONPATH : $PYTHONPATH \
169 170 --prefix PATH : $PATH \
170 171 --set PYTHONHASHSEED random
171 172 done
172 173
173 174 mkdir $out/etc
174 175 cp configs/production.ini $out/etc
175 176
176 177 echo "Writing meta information for rccontrol to nix-support/rccontrol"
177 178 mkdir -p $out/nix-support/rccontrol
178 179 cp -v rhodecode/VERSION $out/nix-support/rccontrol/version
179 180 echo "DONE: Meta information for rccontrol written"
180 181
181 182 # TODO: johbo: Make part of ac-tests
182 183 if [ ! -f rhodecode/public/js/scripts.js ]; then
183 184 echo "Missing scripts.js"
184 185 exit 1
185 186 fi
186 187 if [ ! -f rhodecode/public/css/style.css ]; then
187 188 echo "Missing style.css"
188 189 exit 1
189 190 fi
190 191 '';
191 192
192 193 });
193 194
194 195 rhodecode-testdata = import "${rhodecode-testdata-src}/default.nix" {
195 196 inherit
196 197 doCheck
197 198 pkgs
198 199 pythonPackages;
199 200 };
200 201
201 202 };
202 203
203 204 rhodecode-testdata-src = sources.rhodecode-testdata or (
204 205 pkgs.fetchhg {
205 206 url = "https://code.rhodecode.com/upstream/rc_testdata";
206 207 rev = "v0.8.0";
207 208 sha256 = "0hy1ba134rq2f9si85yx7j4qhc9ky0hjzdk553s3q026i7km809m";
208 209 });
209 210
210 211 # Apply all overrides and fix the final package set
211 212 myPythonPackagesUnfix =
212 213 (extends pythonExternalOverrides
213 214 (extends pythonLocalOverrides
214 215 (extends pythonOverrides
215 216 pythonGeneratedPackages)));
216 217 myPythonPackages = (fix myPythonPackagesUnfix);
217 218
218 219 in myPythonPackages.rhodecode-enterprise-ce
General Comments 0
You need to be logged in to leave comments. Login now