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