From 2a6ab6de219a5b000485e37f5ae8665716d4f803 Mon Sep 17 00:00:00 2001 From: Valentin Gagarin Date: Fri, 6 Jun 2025 12:14:34 +0200 Subject: [PATCH] use deployed environment for launching nixops4 from the panel --- panel/env.nix | 6 ------ panel/nix/configuration.nix | 7 +++++++ panel/src/panel/settings.py | 2 -- panel/src/panel/views.py | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/panel/env.nix b/panel/env.nix index 07ce4193..009d29e2 100644 --- a/panel/env.nix +++ b/panel/env.nix @@ -9,10 +9,4 @@ in { REPO_DIR = toString ../.; # explicitly use nix, as e.g. lix does not have configurable-impure-env - BIN_PATH = lib.makeBinPath [ - # explicitly use nix, as e.g. lix does not have configurable-impure-env - pkgs.nix - # nixops error maybe due to our flake git hook: executing 'git': No such file or directory - pkgs.git - ]; } diff --git a/panel/nix/configuration.nix b/panel/nix/configuration.nix index b0bcd5c4..6240d990 100644 --- a/panel/nix/configuration.nix +++ b/panel/nix/configuration.nix @@ -181,6 +181,13 @@ in path = [ python-environment manage-service + # TODO(@fricklerhandwerk): not sure why we the following + # XXX(@kiara): explicitly use Nix, as e.g. Lix does not have `--configurable-impure-env` + # XXX(@fricklerhandwerk): NixOps4 brings its own Nix IIUC, and so that should go out when we remove `nix develop` + pkgs.nix + # XXX(@kiara): nixops error maybe due to our flake git hook: executing 'git': No such file or directory + # XXX(@fricklerhandwerk): We shouldn't need Git at all. Also maybe due to `nix develop`? + pkgs.git ]; preStart = '' # Auto-migrate on first run or if the package has changed diff --git a/panel/src/panel/settings.py b/panel/src/panel/settings.py index bbfa753a..14b1a96f 100644 --- a/panel/src/panel/settings.py +++ b/panel/src/panel/settings.py @@ -240,8 +240,6 @@ if user_settings_file is not None: # The correct thing to do here would be using a helper function such as with `get_secret()` that will catch the exception and explain what's wrong and where to put the right values. # Replacing the `USER_SETTINGS_FILE` mechanism following the comment there would probably be a good thing. -# PATH to expose to launch button -bin_path=env['BIN_PATH'] # path of the root flake to trigger nixops from, see #94. # to deploy this should be specified, for dev just use a relative path. repo_dir = env["REPO_DIR"] diff --git a/panel/src/panel/views.py b/panel/src/panel/views.py index 9b1e902e..ad0bbf58 100644 --- a/panel/src/panel/views.py +++ b/panel/src/panel/views.py @@ -89,7 +89,7 @@ class DeploymentStatus(ConfigurationForm): def deployment(self, config: BaseModel): env = { - "PATH": settings.bin_path, + "PATH": os.environ.get("PATH"), # pass in form info to our deployment "DEPLOYMENT": config.json() }