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