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