##// END OF EJS Templates
release: Provide attribute releaseName...
johbo -
r241:17b8c613 default
parent child Browse files
Show More
@@ -1,225 +1,227 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 # Load the generated node packages
53 53 nodePackages = pkgs.callPackage "${pkgs.path}/pkgs/top-level/node-packages.nix" rec {
54 54 self = nodePackages;
55 55 generated = pkgs.callPackage ./pkgs/node-packages.nix { inherit self; };
56 56 };
57 57
58 58 # TODO: Should be taken automatically out of the generates packages.
59 59 # apps.nix has one solution for this, although I'd prefer to have the deps
60 60 # from package.json mapped in here.
61 61 nodeDependencies = with nodePackages; [
62 62 grunt
63 63 grunt-contrib-concat
64 64 grunt-contrib-jshint
65 65 grunt-contrib-less
66 66 grunt-contrib-watch
67 67 jshint
68 68 ];
69 69
70 70 pythonGeneratedPackages = self: basePythonPackages.override (a: {
71 71 inherit self;
72 72 })
73 73 // (scopedImport {
74 74 self = self;
75 75 super = basePythonPackages;
76 76 inherit pkgs;
77 77 inherit (pkgs) fetchurl fetchgit;
78 78 } ./pkgs/python-packages.nix);
79 79
80 80 pythonOverrides = import ./pkgs/python-packages-overrides.nix {
81 81 inherit
82 82 basePythonPackages
83 83 pkgs;
84 84 };
85 85
86 86 pythonLocalOverrides = self: super: {
87 87 rhodecode-enterprise-ce =
88 88 let
89 89 version = builtins.readFile ./rhodecode/VERSION;
90 90 linkNodeModules = ''
91 91 echo "Link node packages"
92 92 # TODO: check if this adds stuff as a dependency, closure size
93 93 rm -fr node_modules
94 94 mkdir -p node_modules
95 95 ${pkgs.lib.concatMapStrings (dep: ''
96 96 ln -sfv ${dep}/lib/node_modules/${dep.pkgName} node_modules/
97 97 '') nodeDependencies}
98 98 echo "DONE: Link node packages"
99 99 '';
100 100 in super.rhodecode-enterprise-ce.override (attrs: {
101 101
102 inherit doCheck;
102 inherit
103 doCheck
104 version;
103 105 name = "rhodecode-enterprise-ce-${version}";
104 version = version;
106 releaseName = "RhodeCodeEnterpriseCE-${version}";
105 107 src = rhodecode-enterprise-ce-src;
106 108
107 109 buildInputs =
108 110 attrs.buildInputs ++
109 111 (with self; [
110 112 pkgs.nodePackages.grunt-cli
111 113 pkgs.subversion
112 114 pytest-catchlog
113 115 rhodecode-testdata
114 116 ]);
115 117
116 118 propagatedBuildInputs = attrs.propagatedBuildInputs ++ (with self; [
117 119 rhodecode-tools
118 120 ]);
119 121
120 122 # TODO: johbo: Make a nicer way to expose the parts. Maybe
121 123 # pkgs/default.nix?
122 124 passthru = {
123 125 inherit
124 126 pythonLocalOverrides
125 127 myPythonPackagesUnfix;
126 128 pythonPackages = self;
127 129 };
128 130
129 131 LC_ALL = "en_US.UTF-8";
130 132 LOCALE_ARCHIVE =
131 133 if pkgs.stdenv ? glibc
132 134 then "${pkgs.glibcLocales}/lib/locale/locale-archive"
133 135 else "";
134 136
135 137 # Somewhat snappier setup of the development environment
136 138 # TODO: move into shell.nix
137 139 # TODO: think of supporting a stable path again, so that multiple shells
138 140 # can share it.
139 141 shellHook = ''
140 142 tmp_path=$(mktemp -d)
141 143 export PATH="$tmp_path/bin:$PATH"
142 144 export PYTHONPATH="$tmp_path/${self.python.sitePackages}:$PYTHONPATH"
143 145 mkdir -p $tmp_path/${self.python.sitePackages}
144 146 python setup.py develop --prefix $tmp_path --allow-hosts ""
145 147 '' + linkNodeModules;
146 148
147 149 preCheck = ''
148 150 export PATH="$out/bin:$PATH"
149 151 '';
150 152
151 153 postCheck = ''
152 154 rm -rf $out/lib/${self.python.libPrefix}/site-packages/pytest_pylons
153 155 rm -rf $out/lib/${self.python.libPrefix}/site-packages/rhodecode/tests
154 156 '';
155 157
156 158 preBuild = linkNodeModules + ''
157 159 grunt
158 160 rm -fr node_modules
159 161 '';
160 162
161 163 postInstall = ''
162 164 # python based programs need to be wrapped
163 165 ln -s ${self.supervisor}/bin/supervisor* $out/bin/
164 166 ln -s ${self.gunicorn}/bin/gunicorn $out/bin/
165 167 ln -s ${self.PasteScript}/bin/paster $out/bin/
166 168 ln -s ${self.pyramid}/bin/* $out/bin/ #*/
167 169
168 170 # rhodecode-tools
169 171 # TODO: johbo: re-think this. Do the tools import anything from enterprise?
170 172 ln -s ${self.rhodecode-tools}/bin/rhodecode-* $out/bin/
171 173
172 174 # note that condition should be restricted when adding further tools
173 175 for file in $out/bin/*; do #*/
174 176 wrapProgram $file \
175 177 --prefix PYTHONPATH : $PYTHONPATH \
176 178 --prefix PATH : $PATH \
177 179 --set PYTHONHASHSEED random
178 180 done
179 181
180 182 mkdir $out/etc
181 183 cp configs/production.ini $out/etc
182 184
183 185 echo "Writing meta information for rccontrol to nix-support/rccontrol"
184 186 mkdir -p $out/nix-support/rccontrol
185 187 cp -v rhodecode/VERSION $out/nix-support/rccontrol/version
186 188 echo "DONE: Meta information for rccontrol written"
187 189
188 190 # TODO: johbo: Make part of ac-tests
189 191 if [ ! -f rhodecode/public/js/scripts.js ]; then
190 192 echo "Missing scripts.js"
191 193 exit 1
192 194 fi
193 195 if [ ! -f rhodecode/public/css/style.css ]; then
194 196 echo "Missing style.css"
195 197 exit 1
196 198 fi
197 199 '';
198 200
199 201 });
200 202
201 203 rhodecode-testdata = import "${rhodecode-testdata-src}/default.nix" {
202 204 inherit
203 205 doCheck
204 206 pkgs
205 207 pythonPackages;
206 208 };
207 209
208 210 };
209 211
210 212 rhodecode-testdata-src = sources.rhodecode-testdata or (
211 213 pkgs.fetchhg {
212 214 url = "https://code.rhodecode.com/upstream/rc_testdata";
213 215 rev = "v0.8.0";
214 216 sha256 = "0hy1ba134rq2f9si85yx7j4qhc9ky0hjzdk553s3q026i7km809m";
215 217 });
216 218
217 219 # Apply all overrides and fix the final package set
218 220 myPythonPackagesUnfix =
219 221 (extends pythonExternalOverrides
220 222 (extends pythonLocalOverrides
221 223 (extends pythonOverrides
222 224 pythonGeneratedPackages)));
223 225 myPythonPackages = (fix myPythonPackagesUnfix);
224 226
225 227 in myPythonPackages.rhodecode-enterprise-ce
General Comments 0
You need to be logged in to leave comments. Login now