add NIX_DIR
This commit is contained in:
parent
fcbbce0405
commit
6bc3016585
3 changed files with 10 additions and 9 deletions
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
self,
|
self,
|
||||||
config,
|
config,
|
||||||
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
@ -44,5 +45,6 @@ in
|
||||||
};
|
};
|
||||||
systemd.services.${name}.env = {
|
systemd.services.${name}.env = {
|
||||||
REPO_DIR = builtins.trace self self;
|
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 :(
|
# FIXME: ending a path in a non-name produces a double hash :(
|
||||||
REPO_DIR = ./..;
|
REPO_DIR = ./..;
|
||||||
|
NIX_DIR = pkgs.nix;
|
||||||
};
|
};
|
||||||
|
|
||||||
tests = pkgs'.callPackage ./nix/tests.nix { };
|
tests = pkgs'.callPackage ./nix/tests.nix { };
|
||||||
|
|
|
@ -12,23 +12,18 @@ from panel import models
|
||||||
from panel.configuration import forms
|
from panel.configuration import forms
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Index(TemplateView):
|
class Index(TemplateView):
|
||||||
template_name = 'index.html'
|
template_name = 'index.html'
|
||||||
|
|
||||||
|
|
||||||
class AccountDetail(LoginRequiredMixin, DetailView):
|
class AccountDetail(LoginRequiredMixin, DetailView):
|
||||||
model = User
|
model = User
|
||||||
template_name = 'account_detail.html'
|
template_name = 'account_detail.html'
|
||||||
|
|
||||||
def get_object(self):
|
def get_object(self):
|
||||||
return self.request.user
|
return self.request.user
|
||||||
|
|
||||||
|
|
||||||
class ServiceList(TemplateView):
|
class ServiceList(TemplateView):
|
||||||
template_name = 'service_list.html'
|
template_name = 'service_list.html'
|
||||||
|
|
||||||
|
|
||||||
class ConfigurationForm(LoginRequiredMixin, FormView):
|
class ConfigurationForm(LoginRequiredMixin, FormView):
|
||||||
template_name = 'configuration_form.html'
|
template_name = 'configuration_form.html'
|
||||||
success_url = reverse_lazy('configuration_form')
|
success_url = reverse_lazy('configuration_form')
|
||||||
|
@ -48,10 +43,13 @@ class ConfigurationForm(LoginRequiredMixin, FormView):
|
||||||
if "deploy" in self.request.POST.keys():
|
if "deploy" in self.request.POST.keys():
|
||||||
print("DEPLOYING:")
|
print("DEPLOYING:")
|
||||||
print(os.getenv("REPO_DIR"))
|
print(os.getenv("REPO_DIR"))
|
||||||
config_dict = obj.parsed_value.model_dump_json()
|
print(os.getenv("NIX_DIR"))
|
||||||
print(f"config_dict: {config_dict}")
|
env={
|
||||||
subprocess.run(["nix", "develop", "--command", "nixops4", "apply",
|
"DEPLOYMENT": obj.parsed_value.model_dump_json(),
|
||||||
"test"], cwd=os.getenv("REPO_DIR"), env={"DEPLOYMENT": config_dict})
|
"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
|
return obj
|
||||||
|
|
||||||
# TODO(@fricklerhandwerk):
|
# TODO(@fricklerhandwerk):
|
||||||
|
|
Loading…
Add table
Reference in a new issue