forked from Fediversity/Fediversity
Pass REPO_DIR implicitly
This commit is contained in:
parent
3b6fcc2878
commit
7b6e8fa9ba
2 changed files with 10 additions and 4 deletions
|
@ -35,8 +35,6 @@ in
|
||||||
export CREDENTIALS_DIRECTORY=${builtins.toString ./.credentials}
|
export CREDENTIALS_DIRECTORY=${builtins.toString ./.credentials}
|
||||||
export DATABASE_URL="sqlite:///${toString ./src}/db.sqlite3"
|
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;
|
NIX_DIR = pkgs.nix;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
import os
|
||||||
|
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
import os
|
import os
|
||||||
|
@ -12,18 +13,23 @@ 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')
|
||||||
|
@ -44,12 +50,14 @@ class ConfigurationForm(LoginRequiredMixin, FormView):
|
||||||
print("DEPLOYING:")
|
print("DEPLOYING:")
|
||||||
print(os.getenv("REPO_DIR"))
|
print(os.getenv("REPO_DIR"))
|
||||||
print(os.getenv("NIX_DIR"))
|
print(os.getenv("NIX_DIR"))
|
||||||
env={
|
env = {
|
||||||
"DEPLOYMENT": obj.parsed_value.model_dump_json(),
|
"DEPLOYMENT": obj.parsed_value.model_dump_json(),
|
||||||
"PATH": f"{os.getenv("NIX_DIR")}/bin/",
|
"PATH": f"{os.getenv("NIX_DIR")}/bin/",
|
||||||
}
|
}
|
||||||
print(f"env: {env}")
|
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
|
return obj
|
||||||
|
|
||||||
# TODO(@fricklerhandwerk):
|
# TODO(@fricklerhandwerk):
|
||||||
|
|
Loading…
Add table
Reference in a new issue