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