|
1 | 1 | # code-owner: @agoose77 |
2 | | -# This flake sets up an FSH dev-shell that installs all the required |
| 2 | +# This flake sets up a dev-shell that installs all the required |
3 | 3 | # packages for running deployer, and then installs the tool in the virtual environment |
4 | 4 | # It is not best-practice for the nix-way of distributing this code, |
5 | 5 | # but its purpose is to get an environment up and running. |
|
23 | 23 | gdk = pkgs.google-cloud-sdk.withExtraComponents (with pkgs.google-cloud-sdk.components; [ |
24 | 24 | gke-gcloud-auth-plugin |
25 | 25 | ]); |
| 26 | + openstack = python.pkgs.toPythonApplication ( |
| 27 | + python.pkgs.python-openstackclient.overridePythonAttrs (oldAttrs: { |
| 28 | + dependencies = |
| 29 | + (oldAttrs.dependencies or []) |
| 30 | + ++ [python.pkgs.python-magnumclient]; |
| 31 | + }) |
| 32 | + ); |
26 | 33 | python = pkgs.python313; |
27 | 34 | packages = |
28 | 35 | [ |
29 | 36 | python |
| 37 | + python.pkgs.venvShellHook |
30 | 38 | ] |
31 | 39 | ++ (with pkgs; [ |
32 | 40 | cmake |
|
43 | 51 | awscli2 |
44 | 52 | azure-cli |
45 | 53 | terraform |
| 54 | + openstack |
46 | 55 | eksctl |
47 | 56 | ]); |
48 | | - shellHook = '' |
49 | | - # Unset leaky PYTHONPATH |
50 | | - unset PYTHONPATH |
51 | | -
|
52 | | - __hash=$(echo ${python.interpreter} | sha256sum) |
53 | | -
|
54 | | - # Setup if not defined #### |
55 | | - if [[ ! -f ".venv/$__hash" ]]; then |
56 | | - __setup_env() { |
57 | | - # Remove existing venv |
58 | | - if [[ -d .venv ]]; then |
59 | | - rm -r .venv |
60 | | - fi |
61 | | -
|
62 | | - # Stand up new venv |
63 | | - ${python.interpreter} -m venv .venv |
64 | | -
|
65 | | - ".venv/bin/python" -m pip install -e ".[dev]" |
66 | | -
|
67 | | - # Add a marker that marks this venv as "ready" |
68 | | - touch ".venv/$__hash" |
69 | | - } |
70 | | -
|
71 | | - __setup_env |
72 | | - fi |
73 | | - ########################### |
74 | | -
|
75 | | - # Activate venv |
76 | | - source .venv/bin/activate |
77 | | - ''; |
78 | 57 | env = lib.optionalAttrs pkgs.stdenv.isLinux { |
79 | 58 | # Python uses dynamic loading for certain libraries. |
80 | 59 | # We'll set the linker path instead of patching RPATH |
81 | 60 | LD_LIBRARY_PATH = lib.makeLibraryPath pkgs.pythonManylinuxPackages.manylinux2014; |
82 | 61 | }; |
83 | 62 | in { |
84 | 63 | devShell = pkgs.mkShell { |
85 | | - inherit env packages shellHook; |
| 64 | + inherit env packages; |
| 65 | + |
| 66 | + venvDir = "./.venv"; |
| 67 | + postShellHook = '' |
| 68 | + unset SOURCE_DATE_EPOCH PYTHONPATH |
| 69 | + ''; |
| 70 | + postVenvCreation = '' |
| 71 | + unset SOURCE_DATE_EPOCH PYTHONPATH |
| 72 | + pip install -e ".[dev]" |
| 73 | + ''; |
86 | 74 | }; |
87 | 75 | }); |
88 | 76 | } |
0 commit comments