forked from fediversity/fediversity
		
	add NIX_DIR
This commit is contained in:
		
							parent
							
								
									bc670296d7
								
							
						
					
					
						commit
						3b6fcc2878
					
				
					 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 { };
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,23 +12,18 @@ from panel import models
 | 
			
		|||
from panel.configuration import forms
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
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')
 | 
			
		||||
| 
						 | 
				
			
			@ -48,10 +43,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