forked from fediversity/fediversity
		
	add NIX_DIR
This commit is contained in:
		
							parent
							
								
									25e16fed7a
								
							
						
					
					
						commit
						361484c658
					
				
					 3 changed files with 10 additions and 9 deletions
				
			
		|  | @ -1,6 +1,7 @@ | |||
| { | ||||
|   self, | ||||
|   config, | ||||
|   pkgs, | ||||
|   ... | ||||
| }: | ||||
| let | ||||
|  | @ -44,5 +45,6 @@ in | |||
|   }; | ||||
|   systemd.services.${name}.env = { | ||||
|     REPO_DIR = builtins.trace self self; | ||||
|     NIX_DIR = pkgs.nix; | ||||
|   }; | ||||
| } | ||||
|  |  | |||
|  | @ -37,6 +37,7 @@ in | |||
|     ''; | ||||
|     # FIXME: ending a path in a non-name produces a double hash :( | ||||
|     REPO_DIR = ./..; | ||||
|     NIX_DIR = pkgs.nix; | ||||
|   }; | ||||
| 
 | ||||
|   tests = pkgs'.callPackage ./nix/tests.nix { }; | ||||
|  |  | |||
|  | @ -11,23 +11,18 @@ 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') | ||||
|  | @ -51,10 +46,13 @@ class ConfigurationForm(LoginRequiredMixin, FormView): | |||
|         if "deploy" in self.request.POST.keys(): | ||||
|             print("DEPLOYING:") | ||||
|             print(os.getenv("REPO_DIR")) | ||||
|             config_dict = obj.parsed_value.model_dump_json() | ||||
|             print(f"config_dict: {config_dict}") | ||||
|             subprocess.run(["nix", "develop", "--command", "nixops4", "apply", | ||||
|                            "test"], cwd=os.getenv("REPO_DIR"), env={"DEPLOYMENT": config_dict}) | ||||
|             print(os.getenv("NIX_DIR")) | ||||
|             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) | ||||
|         return obj | ||||
| 
 | ||||
|     # TODO(@fricklerhandwerk): | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue