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