Show More
@@ -1,117 +1,119 b'' | |||||
1 | # This file contains the adjustments which are desired for a development |
|
1 | # This file contains the adjustments which are desired for a development | |
2 | # environment. |
|
2 | # environment. | |
3 |
|
3 | |||
4 | { pkgs ? (import <nixpkgs> {}) |
|
4 | { pkgs ? (import <nixpkgs> {}) | |
5 | , pythonPackages ? "python27Packages" |
|
5 | , pythonPackages ? "python27Packages" | |
6 | , doCheck ? false |
|
6 | , doCheck ? false | |
7 | , sourcesOverrides ? {} |
|
7 | , sourcesOverrides ? {} | |
8 | , doDevelopInstall ? true |
|
8 | , doDevelopInstall ? true | |
|
9 | , doReleaseInstall ? false | |||
9 | }: |
|
10 | }: | |
10 |
|
11 | |||
11 | let |
|
12 | let | |
12 | # Get sources from config and update them with overrides. |
|
13 | # Get sources from config and update them with overrides. | |
13 | sources = (pkgs.config.rc.sources or {}) // sourcesOverrides; |
|
14 | sources = (pkgs.config.rc.sources or {}) // sourcesOverrides; | |
14 |
|
15 | |||
15 | enterprise-ce = import ./default.nix { |
|
16 | enterprise-ce = import ./default.nix { | |
16 | inherit |
|
17 | inherit | |
17 | pythonPackages |
|
18 | pythonPackages | |
18 | doCheck; |
|
19 | doCheck; | |
19 | }; |
|
20 | }; | |
20 |
|
21 | |||
21 | ce-pythonPackages = enterprise-ce.pythonPackages; |
|
22 | ce-pythonPackages = enterprise-ce.pythonPackages; | |
22 |
|
23 | |||
23 | # This method looks up a path from `pkgs.config.rc.sources` and returns a |
|
24 | # This method looks up a path from `pkgs.config.rc.sources` and returns a | |
24 | # shell script which does a `python setup.py develop` installation of it. If |
|
25 | # shell script which does a `python setup.py develop` installation of it. If | |
25 | # no path is found it will return an empty string. |
|
26 | # no path is found it will return an empty string. | |
26 | optionalDevelopInstall = attributeName: |
|
27 | optionalDevelopInstall = attributeName: | |
27 | let |
|
28 | let | |
28 | path = pkgs.lib.attrByPath [attributeName] null sources; |
|
29 | path = pkgs.lib.attrByPath [attributeName] null sources; | |
29 | doIt = doDevelopInstall && path != null; |
|
30 | doIt = doDevelopInstall && path != null; | |
30 |
|
31 | |||
31 | in |
|
32 | in | |
32 | # do develop installation with empty hosts to skip any package duplicates to |
|
33 | # do develop installation with empty hosts to skip any package duplicates to | |
33 | # be replaced. This only pushes the package to be locally available |
|
34 | # be replaced. This only pushes the package to be locally available | |
34 | pkgs.lib.optionalString doIt ('' |
|
35 | pkgs.lib.optionalString doIt ('' | |
35 | echo "[BEGIN] Develop install of '${attributeName}' from '${path}'" |
|
36 | echo "[BEGIN] Develop install of '${attributeName}' from '${path}'" | |
36 | pushd ${path} |
|
37 | pushd ${path} | |
37 | python setup.py develop --prefix $tmp_path --allow-hosts "" |
|
38 | python setup.py develop --prefix $tmp_path --allow-hosts "" | |
38 | popd |
|
39 | popd | |
39 | echo "[DONE] Develop install of '${attributeName}' from '${path}'" |
|
40 | echo "[DONE] Develop install of '${attributeName}' from '${path}'" | |
40 | echo "" |
|
41 | echo "" | |
41 | ''); |
|
42 | ''); | |
42 |
|
43 | |||
43 | # This method looks up a path from `pkgs.config.rc.sources` and imports the |
|
44 | # This method looks up a path from `pkgs.config.rc.sources` and imports the | |
44 | # default.nix file if it exists. It returns the list of build inputs. If no |
|
45 | # default.nix file if it exists. It returns the list of build inputs. If no | |
45 | # path is found it will return an empty list. |
|
46 | # path is found it will return an empty list. | |
46 | optionalDevelopInstallBuildInputs = attributeName: |
|
47 | optionalDevelopInstallBuildInputs = attributeName: | |
47 | let |
|
48 | let | |
48 | path = pkgs.lib.attrByPath [attributeName] null sources; |
|
49 | path = pkgs.lib.attrByPath [attributeName] null sources; | |
49 | doIt = doDevelopInstall && path != null && pkgs.lib.pathExists "${nixFile}"; |
|
50 | doIt = doDevelopInstall && path != null && pkgs.lib.pathExists "${nixFile}"; | |
50 | nixFile = "${path}/default.nix"; |
|
51 | nixFile = "${path}/default.nix"; | |
51 |
|
52 | |||
52 | derivate = import "${nixFile}" { |
|
53 | derivate = import "${nixFile}" { | |
53 | inherit |
|
54 | inherit | |
54 | doCheck |
|
55 | doCheck | |
55 | pythonPackages; |
|
56 | pythonPackages; | |
56 | }; |
|
57 | }; | |
57 | in |
|
58 | in | |
58 | pkgs.lib.lists.optionals doIt ( |
|
59 | pkgs.lib.lists.optionals doIt ( | |
59 | derivate.propagatedBuildInputs |
|
60 | derivate.propagatedBuildInputs | |
60 | ); |
|
61 | ); | |
61 |
|
62 | |||
62 | developInstalls = [ "rhodecode-vcsserver" ]; |
|
63 | developInstalls = [ "rhodecode-vcsserver" ]; | |
63 |
|
64 | |||
64 | in enterprise-ce.override (attrs: { |
|
65 | in enterprise-ce.override (attrs: { | |
65 | # Avoid that we dump any sources into the store when entering the shell and |
|
66 | # Avoid that we dump any sources into the store when entering the shell and | |
66 | # make development a little bit more convenient. |
|
67 | # make development a little bit more convenient. | |
67 | src = null; |
|
68 | src = null; | |
68 |
|
69 | |||
69 | # Add dependencies which are useful for the development environment. |
|
70 | # Add dependencies which are useful for the development environment. | |
70 | buildInputs = |
|
71 | buildInputs = | |
71 | attrs.buildInputs ++ |
|
72 | attrs.buildInputs ++ | |
72 |
(with ce-pythonPackages; |
|
73 | (with ce-pythonPackages; | |
73 | bumpversion |
|
74 | [ ipdb ] | |
74 | invoke |
|
75 | ++ pkgs.lib.lists.optionals doReleaseInstall ( | |
75 | ipdb |
|
76 | [invoke bumpversion] | |
76 |
|
|
77 | ) | |
|
78 | ); | |||
77 |
|
79 | |||
78 | # place to inject some required libs from develop installs |
|
80 | # place to inject some required libs from develop installs | |
79 | propagatedBuildInputs = |
|
81 | propagatedBuildInputs = | |
80 | attrs.propagatedBuildInputs ++ |
|
82 | attrs.propagatedBuildInputs ++ | |
81 | pkgs.lib.lists.concatMap optionalDevelopInstallBuildInputs developInstalls; |
|
83 | pkgs.lib.lists.concatMap optionalDevelopInstallBuildInputs developInstalls; | |
82 |
|
84 | |||
83 |
|
85 | |||
84 | # Make sure we execute both hooks |
|
86 | # Make sure we execute both hooks | |
85 | shellHook = '' |
|
87 | shellHook = '' | |
86 | runHook preShellHook |
|
88 | runHook preShellHook | |
87 | runHook postShellHook |
|
89 | runHook postShellHook | |
88 | ''; |
|
90 | ''; | |
89 |
|
91 | |||
90 | preShellHook = '' |
|
92 | preShellHook = '' | |
91 | echo "Entering CE-Shell" |
|
93 | echo "Entering CE-Shell" | |
92 |
|
94 | |||
93 | # Custom prompt to distinguish from other dev envs. |
|
95 | # Custom prompt to distinguish from other dev envs. | |
94 | export PS1="\n\[\033[1;32m\][CE-shell:\w]$\[\033[0m\] " |
|
96 | export PS1="\n\[\033[1;32m\][CE-shell:\w]$\[\033[0m\] " | |
95 |
|
97 | |||
96 | echo "Building frontend assets" |
|
98 | echo "Building frontend assets" | |
97 | ${enterprise-ce.linkNodePackages} |
|
99 | ${enterprise-ce.linkNodePackages} | |
98 |
|
100 | |||
99 | # Setup a temporary directory. |
|
101 | # Setup a temporary directory. | |
100 | tmp_path=$(mktemp -d) |
|
102 | tmp_path=$(mktemp -d) | |
101 | export PATH="$tmp_path/bin:$PATH" |
|
103 | export PATH="$tmp_path/bin:$PATH" | |
102 | export PYTHONPATH="$tmp_path/${ce-pythonPackages.python.sitePackages}:$PYTHONPATH" |
|
104 | export PYTHONPATH="$tmp_path/${ce-pythonPackages.python.sitePackages}:$PYTHONPATH" | |
103 | mkdir -p $tmp_path/${ce-pythonPackages.python.sitePackages} |
|
105 | mkdir -p $tmp_path/${ce-pythonPackages.python.sitePackages} | |
104 |
|
106 | |||
105 | # Develop installation |
|
107 | # Develop installation | |
106 | echo "[BEGIN]: develop install of rhodecode-enterprise-ce" |
|
108 | echo "[BEGIN]: develop install of rhodecode-enterprise-ce" | |
107 | python setup.py develop --prefix $tmp_path --allow-hosts "" |
|
109 | python setup.py develop --prefix $tmp_path --allow-hosts "" | |
108 | ''; |
|
110 | ''; | |
109 |
|
111 | |||
110 | postShellHook = '' |
|
112 | postShellHook = '' | |
111 | echo "** Additional develop installs **" |
|
113 | echo "** Additional develop installs **" | |
112 | '' + |
|
114 | '' + | |
113 | pkgs.lib.strings.concatMapStrings optionalDevelopInstall developInstalls |
|
115 | pkgs.lib.strings.concatMapStrings optionalDevelopInstall developInstalls | |
114 | + '' |
|
116 | + '' | |
115 | ''; |
|
117 | ''; | |
116 |
|
118 | |||
117 | }) |
|
119 | }) |
General Comments 0
You need to be logged in to leave comments.
Login now