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