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