##// END OF EJS Templates
nix: Add releaseName to derivation.
johbo -
r33:84ce733d default
parent child Browse files
Show More
@@ -1,144 +1,145 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 67 version = builtins.readFile ./vcsserver/VERSION;
68 68
69 69 pythonLocalOverrides = self: super: {
70 70 rhodecode-vcsserver = super.rhodecode-vcsserver.override (attrs: {
71 71 inherit
72 72 doCheck
73 73 version;
74 74 name = "rhodecode-vcsserver-${version}";
75 releaseName = "RhodeCodeVCSServer-${version}";
75 76 src = rhodecode-vcsserver-src;
76 77
77 78 propagatedBuildInputs = attrs.propagatedBuildInputs ++ ([
78 79 pkgs.git
79 80 pkgs.subversion
80 81 ]);
81 82
82 83 # TODO: johbo: Make a nicer way to expose the parts. Maybe
83 84 # pkgs/default.nix?
84 85 passthru = {
85 86 pythonPackages = self;
86 87 };
87 88
88 89 # Somewhat snappier setup of the development environment
89 90 # TODO: move into shell.nix
90 91 # TODO: think of supporting a stable path again, so that multiple shells
91 92 # can share it.
92 93 shellHook = ''
93 94 # Set locale
94 95 export LC_ALL="en_US.UTF-8"
95 96
96 97 tmp_path=$(mktemp -d)
97 98 export PATH="$tmp_path/bin:$PATH"
98 99 export PYTHONPATH="$tmp_path/${self.python.sitePackages}:$PYTHONPATH"
99 100 mkdir -p $tmp_path/${self.python.sitePackages}
100 101 python setup.py develop --prefix $tmp_path --allow-hosts ""
101 102 '';
102 103
103 104 # Add VCSServer bin directory to path so that tests can find 'vcsserver'.
104 105 preCheck = ''
105 106 export PATH="$out/bin:$PATH"
106 107 '';
107 108
108 109 postInstall = ''
109 110 echo "Writing meta information for rccontrol to nix-support/rccontrol"
110 111 mkdir -p $out/nix-support/rccontrol
111 112 cp -v vcsserver/VERSION $out/nix-support/rccontrol/version
112 113 echo "DONE: Meta information for rccontrol written"
113 114
114 115 ln -s ${self.pyramid}/bin/* $out/bin #*/
115 116 ln -s ${self.gunicorn}/bin/gunicorn $out/bin/
116 117
117 118 # Symlink version control utilities
118 119 #
119 120 # We ensure that always the correct version is available as a symlink.
120 121 # So that users calling them via the profile path will always use the
121 122 # correct version.
122 123 ln -s ${pkgs.git}/bin/git $out/bin
123 124 ln -s ${self.mercurial}/bin/hg $out/bin
124 125 ln -s ${pkgs.subversion}/bin/svn* $out/bin
125 126
126 127 for file in $out/bin/*; do #*/
127 128 wrapProgram $file \
128 129 --prefix PYTHONPATH : $PYTHONPATH \
129 130 --set PYTHONHASHSEED random
130 131 done
131 132 '';
132 133
133 134 });
134 135 };
135 136
136 137 # Apply all overrides and fix the final package set
137 138 myPythonPackages =
138 139 (fix
139 140 (extends pythonExternalOverrides
140 141 (extends pythonLocalOverrides
141 142 (extends pythonOverrides
142 143 pythonGeneratedPackages))));
143 144
144 145 in myPythonPackages.rhodecode-vcsserver
General Comments 0
You need to be logged in to leave comments. Login now