forked from fediversity/fediversity
		
	Pass REPO_DIR implicitly
This commit is contained in:
		
							parent
							
								
									361484c658
								
							
						
					
					
						commit
						ebb019307b
					
				
					 2 changed files with 10 additions and 4 deletions
				
			
		|  | @ -35,8 +35,6 @@ in | |||
|       export CREDENTIALS_DIRECTORY=${builtins.toString ./.credentials} | ||||
|       export DATABASE_URL="sqlite:///${toString ./src}/db.sqlite3" | ||||
|     ''; | ||||
|     # FIXME: ending a path in a non-name produces a double hash :( | ||||
|     REPO_DIR = ./..; | ||||
|     NIX_DIR = pkgs.nix; | ||||
|   }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,4 +1,5 @@ | |||
| from enum import Enum | ||||
| import os | ||||
| 
 | ||||
| from django.urls import reverse_lazy | ||||
| import os | ||||
|  | @ -11,18 +12,23 @@ from django.views.generic.edit import FormView | |||
| from panel import models | ||||
| from panel.configuration import Version | ||||
| 
 | ||||
| 
 | ||||
| class Index(TemplateView): | ||||
|     template_name = 'index.html' | ||||
| 
 | ||||
| 
 | ||||
| class AccountDetail(LoginRequiredMixin, DetailView): | ||||
|     model = User | ||||
|     template_name = 'account_detail.html' | ||||
| 
 | ||||
|     def get_object(self): | ||||
|         return self.request.user | ||||
| 
 | ||||
| 
 | ||||
| class ServiceList(TemplateView): | ||||
|     template_name = 'service_list.html' | ||||
| 
 | ||||
| 
 | ||||
| class ConfigurationForm(LoginRequiredMixin, FormView): | ||||
|     template_name = 'configuration_form.html' | ||||
|     success_url = reverse_lazy('configuration_form') | ||||
|  | @ -47,12 +53,14 @@ class ConfigurationForm(LoginRequiredMixin, FormView): | |||
|             print("DEPLOYING:") | ||||
|             print(os.getenv("REPO_DIR")) | ||||
|             print(os.getenv("NIX_DIR")) | ||||
|             env={ | ||||
|             env = { | ||||
|                 "DEPLOYMENT": obj.parsed_value.model_dump_json(), | ||||
|                 "PATH": f"{os.getenv("NIX_DIR")}/bin/", | ||||
|             } | ||||
|             print(f"env: {env}") | ||||
|             subprocess.run(["nix", "develop", "--command", "nixops4", "--show-trace", "--verbose", "apply", "test"], cwd=os.getenv("REPO_DIR"), env=env) | ||||
|             print(f"Path: {os.getcwd()}/..") | ||||
|             subprocess.run(["nix", "develop", "--command", "nixops4", "--show-trace", | ||||
|                            "--verbose", "apply", "test"], cwd=os.getenv("REPO_DIR") or f"{os.getcwd()}/..", env=env) | ||||
|         return obj | ||||
| 
 | ||||
|     # TODO(@fricklerhandwerk): | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue