##// END OF EJS Templates
core: added wrapped python into binaries so we can execute python hooks that have proper...
marcink -
r326:15ece812 default
parent child Browse files
Show More
@@ -1,165 +1,166 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 { 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 # bump GIT version
18 18 git = pkgs.lib.overrideDerivation pkgs_.git (oldAttrs: {
19 19 name = "git-2.13.5";
20 20 src = pkgs.fetchurl {
21 21 url = "https://www.kernel.org/pub/software/scm/git/git-2.13.5.tar.xz";
22 22 sha256 = "18fi18103n7grshm4ffb0fwsnvbl48sbqy5gqx528vf8maff5j91";
23 23 };
24 24
25 25 patches = [
26 26 ./pkgs/git_patches/docbook2texi.patch
27 27 ./pkgs/git_patches/symlinks-in-bin.patch
28 28 ./pkgs/git_patches/git-sh-i18n.patch
29 29 ./pkgs/git_patches/ssh-path.patch
30 30 ];
31 31
32 32 });
33 33
34 34 # Override subversion derivation to
35 35 # - activate python bindings
36 36 subversion = let
37 37 subversionWithPython = super.subversion.override {
38 38 httpSupport = true;
39 39 pythonBindings = true;
40 40 python = self.python27Packages.python;
41 41 };
42 42
43 43 in
44 44
45 45 pkgs.lib.overrideDerivation subversionWithPython (oldAttrs: {
46 46 name = "subversion-1.9.7";
47 47 src = pkgs.fetchurl {
48 48 url = "https://www.apache.org/dist/subversion/subversion-1.9.7.tar.gz";
49 49 sha256 = "0g3cs2h008z8ymgkhbk54jp87bjh7y049rn42igj881yi2f20an7";
50 50 };
51 51
52 52 });
53 53
54 54 });
55 55
56 56 inherit (pkgs.lib) fix extends;
57 57 basePythonPackages = with builtins; if isAttrs pythonPackages
58 58 then pythonPackages
59 59 else getAttr pythonPackages pkgs;
60 60
61 61 elem = builtins.elem;
62 62 basename = path: with pkgs.lib; last (splitString "/" path);
63 63 startsWith = prefix: full: let
64 64 actualPrefix = builtins.substring 0 (builtins.stringLength prefix) full;
65 65 in actualPrefix == prefix;
66 66
67 67 src-filter = path: type: with pkgs.lib;
68 68 let
69 69 ext = last (splitString "." path);
70 70 in
71 71 !elem (basename path) [".hg" ".git" "__pycache__" ".eggs"
72 72 "node_modules" "build" "data" "tmp"] &&
73 73 !elem ext ["egg-info" "pyc"] &&
74 74 !startsWith "result" path;
75 75
76 76 rhodecode-vcsserver-src = builtins.filterSource src-filter ./.;
77 77
78 78 pythonGeneratedPackages = self: basePythonPackages.override (a: {
79 79 inherit self;
80 80 }) // (scopedImport {
81 81 self = self;
82 82 super = basePythonPackages;
83 83 inherit pkgs;
84 84 inherit (pkgs) fetchurl fetchgit;
85 85 } ./pkgs/python-packages.nix);
86 86
87 87 pythonOverrides = import ./pkgs/python-packages-overrides.nix {
88 88 inherit basePythonPackages pkgs;
89 89 };
90 90
91 91 version = builtins.readFile ./vcsserver/VERSION;
92 92
93 93 pythonLocalOverrides = self: super: {
94 94 rhodecode-vcsserver = super.rhodecode-vcsserver.override (attrs: {
95 95 inherit doCheck version;
96 96
97 97 name = "rhodecode-vcsserver-${version}";
98 98 releaseName = "RhodeCodeVCSServer-${version}";
99 99 src = rhodecode-vcsserver-src;
100 100 dontStrip = true; # prevent strip, we don't need it.
101 101
102 102 propagatedBuildInputs = attrs.propagatedBuildInputs ++ ([
103 103 pkgs.git
104 104 pkgs.subversion
105 105 ]);
106 106
107 107 # TODO: johbo: Make a nicer way to expose the parts. Maybe
108 108 # pkgs/default.nix?
109 109 passthru = {
110 110 pythonPackages = self;
111 111 };
112 112
113 113 # Add VCSServer bin directory to path so that tests can find 'vcsserver'.
114 114 preCheck = ''
115 115 export PATH="$out/bin:$PATH"
116 116 '';
117 117
118 118 # put custom attrs here
119 119 checkPhase = ''
120 120 runHook preCheck
121 121 PYTHONHASHSEED=random py.test -p no:sugar -vv --cov-config=.coveragerc --cov=vcsserver --cov-report=term-missing vcsserver
122 122 runHook postCheck
123 123 '';
124 124
125 125 postInstall = ''
126 126 echo "Writing 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: Meta information for rccontrol written"
130 130
131 131 # python based programs need to be wrapped
132 132 ln -s ${self.pyramid}/bin/* $out/bin/
133 133 ln -s ${self.gunicorn}/bin/gunicorn $out/bin/
134 134
135 135 # Symlink version control utilities
136 136 #
137 137 # We ensure that always the correct version is available as a symlink.
138 138 # So that users calling them via the profile path will always use the
139 139 # correct version.
140 ln -s ${self.python}/bin/python $out/bin
140 141 ln -s ${pkgs.git}/bin/git $out/bin
141 142 ln -s ${self.mercurial}/bin/hg $out/bin
142 143 ln -s ${pkgs.subversion}/bin/svn* $out/bin
143 144
144 145 for file in $out/bin/*;
145 146 do
146 147 wrapProgram $file \
147 148 --set PATH $PATH \
148 149 --set PYTHONPATH $PYTHONPATH \
149 150 --set PYTHONHASHSEED random
150 151 done
151 152
152 153 '';
153 154
154 155 });
155 156 };
156 157
157 158 # Apply all overrides and fix the final package set
158 159 myPythonPackages =
159 160 (fix
160 161 (extends pythonExternalOverrides
161 162 (extends pythonLocalOverrides
162 163 (extends pythonOverrides
163 164 pythonGeneratedPackages))));
164 165
165 166 in myPythonPackages.rhodecode-vcsserver
General Comments 0
You need to be logged in to leave comments. Login now