diff --git a/panel/default.nix b/panel/default.nix index dc8e81ef..0246337f 100644 --- a/panel/default.nix +++ b/panel/default.nix @@ -22,6 +22,7 @@ in packages = [ pkgs.npins manage + pkgs.nix ]; env = { NPINS_DIRECTORY = toString ../npins; diff --git a/panel/nix/configuration.nix b/panel/nix/configuration.nix index d790e30c..7e6cb437 100644 --- a/panel/nix/configuration.nix +++ b/panel/nix/configuration.nix @@ -37,6 +37,7 @@ let django-libsass django_4 setuptools + pkgs.nix ] ++ cfg.package.propagatedBuildInputs ); diff --git a/panel/nix/package.nix b/panel/nix/package.nix index e6196686..c43d850c 100644 --- a/panel/nix/package.nix +++ b/panel/nix/package.nix @@ -2,6 +2,7 @@ lib, sqlite, python3, + nix, }: let src = @@ -50,6 +51,7 @@ python3.pkgs.buildPythonPackage { in [ sqlite + nix ] ++ pythonPackages; diff --git a/panel/src/panel/views.py b/panel/src/panel/views.py index 7134ff06..6629ade2 100644 --- a/panel/src/panel/views.py +++ b/panel/src/panel/views.py @@ -12,6 +12,7 @@ from panel import models from panel.configuration import forms + class Index(TemplateView): template_name = 'index.html' @@ -43,14 +44,14 @@ class ConfigurationForm(LoginRequiredMixin, FormView): operator=self.request.user, ) - button_name = self.request.POST.get('save_draft') or self.request.POST.get('publish') - print(f"self.request.POST: {self.request.POST}") - print(f"button_name: {button_name}") - if button_name == 'deploy': + # Check for deploy button + if "deploy" in self.request.POST.keys(): print("DEPLOYING:") print(os.getenv("REPO_DIR")) - print(obj) - subprocess.run(["nix", "develop", "--command", "nixops4", "apply", "test"], cwd=os.getenv("REPO_DIR"), env={"DEPLOYMENT": obj}) + 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}) return obj # TODO(@fricklerhandwerk):