about summary refs log tree commit diff
path: root/maintainers/scripts/pluginupdate.py
diff options
context:
space:
mode:
authorfigsoda <figsoda@pm.me>2023-08-12 11:32:02 -0400
committerfigsoda <figsoda@pm.me>2023-08-12 11:32:02 -0400
commit32f6cfaae59ad1d1cb1338023015cb6e31c4b2d2 (patch)
tree31a637d6a65ca510cd57fae8260223eb1612b571 /maintainers/scripts/pluginupdate.py
parentaefe566f73164776003ef5ef78003b5f9ccd7c4f (diff)
pluginupdate: don't rely on NIX_PATH
Nix does not respect `NIX_PATH` when the `nix-path` setting in nix.conf is set
Diffstat (limited to 'maintainers/scripts/pluginupdate.py')
-rw-r--r--maintainers/scripts/pluginupdate.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/maintainers/scripts/pluginupdate.py b/maintainers/scripts/pluginupdate.py
index 7c6cfd4fed7f0..f9ec19bed4ae1 100644
--- a/maintainers/scripts/pluginupdate.py
+++ b/maintainers/scripts/pluginupdate.py
@@ -315,9 +315,10 @@ def load_plugins_from_csv(config: FetchConfig, input_file: Path,) -> List[Plugin
     return plugins
 
 def run_nix_expr(expr):
-    with CleanEnvironment():
+    with CleanEnvironment() as nix_path:
         cmd = ["nix", "eval", "--extra-experimental-features",
-                "nix-command", "--impure", "--json", "--expr", expr]
+                "nix-command", "--impure", "--json", "--expr", expr,
+                "--nix-path", nix_path]
         log.debug("Running command %s", " ".join(cmd))
         out = subprocess.check_output(cmd)
         data = json.loads(out)
@@ -521,14 +522,14 @@ class Editor:
 
 
 class CleanEnvironment(object):
-    def __enter__(self) -> None:
+    def __enter__(self) -> str:
         self.old_environ = os.environ.copy()
         local_pkgs = str(Path(__file__).parent.parent.parent)
-        os.environ["NIX_PATH"] = f"localpkgs={local_pkgs}"
         self.empty_config = NamedTemporaryFile()
         self.empty_config.write(b"{}")
         self.empty_config.flush()
         os.environ["NIXPKGS_CONFIG"] = self.empty_config.name
+        return f"localpkgs={local_pkgs}"
 
     def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None:
         os.environ.update(self.old_environ)