From f37d113dff35200b686cfeab16fa406ae3a4372d Mon Sep 17 00:00:00 2001 From: Kiara Grouwstra Date: Fri, 21 Mar 2025 19:03:30 +0100 Subject: [PATCH] expose git to button, fixes error `executing 'git': No such file or directory` --- panel/env.nix | 7 ++++++- panel/src/panel/settings.py | 4 ++-- panel/src/panel/views.py | 3 ++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/panel/env.nix b/panel/env.nix index 5b4e3523..07ce4193 100644 --- a/panel/env.nix +++ b/panel/env.nix @@ -9,5 +9,10 @@ in { REPO_DIR = toString ../.; # explicitly use nix, as e.g. lix does not have configurable-impure-env - NIX_BIN = lib.getExe pkgs.nix; + 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/src/panel/settings.py b/panel/src/panel/settings.py index 192710db..b270612c 100644 --- a/panel/src/panel/settings.py +++ b/panel/src/panel/settings.py @@ -192,8 +192,8 @@ 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. -# a dir of nix supporting experimental feature `configurable-impure-env`. -nix_bin=env['NIX_BIN'] +# 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 c89f5ab3..16d29849 100644 --- a/panel/src/panel/views.py +++ b/panel/src/panel/views.py @@ -58,11 +58,12 @@ class ConfigurationForm(LoginRequiredMixin, FormView): # serialize back and forth now we still need to manually inject the dummy user deployment = json.dumps(dummy_user | json.loads(submission)) env = { + "PATH": settings.bin_path, # pass in form info to our deployment "DEPLOYMENT": deployment, } cmd = [ - settings.nix_bin, + "nix", "develop", # workaround to pass in info to nixops4 thru env vars, tho impure :( "--extra-experimental-features",