Show More
@@ -1,138 +1,152 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 | # bump GIT version | |
|
18 | git = pkgs.lib.overrideDerivation pkgs_.git (oldAttrs: { | |
|
19 | name = "git-2.9.3"; | |
|
20 | src = pkgs.fetchurl { | |
|
21 | url = "https://www.kernel.org/pub/software/scm/git/git-2.9.3.tar.xz"; | |
|
22 | sha256 = "0qzs681a64k3shh5p0rg41l1z16fbk5sj0xga45k34hp1hsp654z"; | |
|
23 | }; | |
|
24 | ||
|
25 | }); | |
|
26 | ||
|
17 | 27 | # Override subversion derivation to |
|
18 | 28 | # - activate python bindings |
|
19 | 29 | subversion = let |
|
20 | 30 | subversionWithPython = super.subversion.override { |
|
21 | 31 | httpSupport = true; |
|
22 | 32 | pythonBindings = true; |
|
23 | 33 | python = self.python27Packages.python; |
|
24 | 34 | }; |
|
25 | in pkgs.lib.overrideDerivation subversionWithPython (oldAttrs: { | |
|
35 | ||
|
36 | in | |
|
37 | ||
|
38 | pkgs.lib.overrideDerivation subversionWithPython (oldAttrs: { | |
|
26 | 39 | patches = (oldAttrs.patches or []) ++ |
|
27 | 40 | pkgs.lib.optionals pkgs.stdenv.isDarwin [ |
|
28 | 41 | # johbo: "import svn.client" fails on darwin currently. |
|
29 | 42 | ./pkgs/subversion-1.9.4-darwin.patch |
|
30 | 43 | ]; |
|
31 | 44 | }); |
|
45 | ||
|
32 | 46 | }); |
|
33 | 47 | |
|
34 | 48 | inherit (pkgs.lib) fix extends; |
|
35 | 49 | |
|
36 | 50 | basePythonPackages = with builtins; if isAttrs pythonPackages |
|
37 | 51 | then pythonPackages |
|
38 | 52 | else getAttr pythonPackages pkgs; |
|
39 | 53 | |
|
40 | 54 | elem = builtins.elem; |
|
41 | 55 | basename = path: with pkgs.lib; last (splitString "/" path); |
|
42 | 56 | startsWith = prefix: full: let |
|
43 | 57 | actualPrefix = builtins.substring 0 (builtins.stringLength prefix) full; |
|
44 | 58 | in actualPrefix == prefix; |
|
45 | 59 | |
|
46 | 60 | src-filter = path: type: with pkgs.lib; |
|
47 | 61 | let |
|
48 | 62 | ext = last (splitString "." path); |
|
49 | 63 | in |
|
50 | 64 | !elem (basename path) [ |
|
51 | 65 | ".git" ".hg" "__pycache__" ".eggs" "node_modules" |
|
52 | 66 | "build" "data" "tmp"] && |
|
53 | 67 | !elem ext ["egg-info" "pyc"] && |
|
54 | 68 | !startsWith "result" path; |
|
55 | 69 | |
|
56 | 70 | rhodecode-vcsserver-src = builtins.filterSource src-filter ./.; |
|
57 | 71 | |
|
58 | 72 | pythonGeneratedPackages = self: basePythonPackages.override (a: { |
|
59 | 73 | inherit self; |
|
60 | 74 | }) |
|
61 | 75 | // (scopedImport { |
|
62 | 76 | self = self; |
|
63 | 77 | super = basePythonPackages; |
|
64 | 78 | inherit pkgs; |
|
65 | 79 | inherit (pkgs) fetchurl fetchgit; |
|
66 | 80 | } ./pkgs/python-packages.nix); |
|
67 | 81 | |
|
68 | 82 | pythonOverrides = import ./pkgs/python-packages-overrides.nix { |
|
69 | 83 | inherit |
|
70 | 84 | basePythonPackages |
|
71 | 85 | pkgs; |
|
72 | 86 | }; |
|
73 | 87 | |
|
74 | 88 | version = builtins.readFile ./vcsserver/VERSION; |
|
75 | 89 | |
|
76 | 90 | pythonLocalOverrides = self: super: { |
|
77 | 91 | rhodecode-vcsserver = super.rhodecode-vcsserver.override (attrs: { |
|
78 | 92 | inherit |
|
79 | 93 | doCheck |
|
80 | 94 | version; |
|
81 | 95 | name = "rhodecode-vcsserver-${version}"; |
|
82 | 96 | releaseName = "RhodeCodeVCSServer-${version}"; |
|
83 | 97 | src = rhodecode-vcsserver-src; |
|
84 | 98 | |
|
85 | 99 | propagatedBuildInputs = attrs.propagatedBuildInputs ++ ([ |
|
86 | 100 | pkgs.git |
|
87 | 101 | pkgs.subversion |
|
88 | 102 | ]); |
|
89 | 103 | |
|
90 | 104 | # TODO: johbo: Make a nicer way to expose the parts. Maybe |
|
91 | 105 | # pkgs/default.nix? |
|
92 | 106 | passthru = { |
|
93 | 107 | pythonPackages = self; |
|
94 | 108 | }; |
|
95 | 109 | |
|
96 | 110 | # Add VCSServer bin directory to path so that tests can find 'vcsserver'. |
|
97 | 111 | preCheck = '' |
|
98 | 112 | export PATH="$out/bin:$PATH" |
|
99 | 113 | ''; |
|
100 | 114 | |
|
101 | 115 | postInstall = '' |
|
102 | 116 | echo "Writing meta information for rccontrol to nix-support/rccontrol" |
|
103 | 117 | mkdir -p $out/nix-support/rccontrol |
|
104 | 118 | cp -v vcsserver/VERSION $out/nix-support/rccontrol/version |
|
105 | 119 | echo "DONE: Meta information for rccontrol written" |
|
106 | 120 | |
|
107 | 121 | ln -s ${self.pyramid}/bin/* $out/bin/ |
|
108 | 122 | ln -s ${self.gunicorn}/bin/gunicorn $out/bin/ |
|
109 | 123 | |
|
110 | 124 | # Symlink version control utilities |
|
111 | 125 | # |
|
112 | 126 | # We ensure that always the correct version is available as a symlink. |
|
113 | 127 | # So that users calling them via the profile path will always use the |
|
114 | 128 | # correct version. |
|
115 | 129 | ln -s ${pkgs.git}/bin/git $out/bin |
|
116 | 130 | ln -s ${self.mercurial}/bin/hg $out/bin |
|
117 | 131 | ln -s ${pkgs.subversion}/bin/svn* $out/bin |
|
118 | 132 | |
|
119 | 133 | for file in $out/bin/*; do |
|
120 | 134 | wrapProgram $file \ |
|
121 | 135 | --set PATH $PATH \ |
|
122 | 136 | --set PYTHONPATH $PYTHONPATH \ |
|
123 | 137 | --set PYTHONHASHSEED random |
|
124 | 138 | done |
|
125 | 139 | ''; |
|
126 | 140 | |
|
127 | 141 | }); |
|
128 | 142 | }; |
|
129 | 143 | |
|
130 | 144 | # Apply all overrides and fix the final package set |
|
131 | 145 | myPythonPackages = |
|
132 | 146 | (fix |
|
133 | 147 | (extends pythonExternalOverrides |
|
134 | 148 | (extends pythonLocalOverrides |
|
135 | 149 | (extends pythonOverrides |
|
136 | 150 | pythonGeneratedPackages)))); |
|
137 | 151 | |
|
138 | 152 | in myPythonPackages.rhodecode-vcsserver |
General Comments 0
You need to be logged in to leave comments.
Login now