diff options
author | figsoda <figsoda@pm.me> | 2023-08-12 11:32:02 -0400 |
---|---|---|
committer | figsoda <figsoda@pm.me> | 2023-08-12 11:32:02 -0400 |
commit | 32f6cfaae59ad1d1cb1338023015cb6e31c4b2d2 (patch) | |
tree | 31a637d6a65ca510cd57fae8260223eb1612b571 /maintainers | |
parent | aefe566f73164776003ef5ef78003b5f9ccd7c4f (diff) | |
download | nixlib-32f6cfaae59ad1d1cb1338023015cb6e31c4b2d2.tar nixlib-32f6cfaae59ad1d1cb1338023015cb6e31c4b2d2.tar.gz nixlib-32f6cfaae59ad1d1cb1338023015cb6e31c4b2d2.tar.bz2 nixlib-32f6cfaae59ad1d1cb1338023015cb6e31c4b2d2.tar.lz nixlib-32f6cfaae59ad1d1cb1338023015cb6e31c4b2d2.tar.xz nixlib-32f6cfaae59ad1d1cb1338023015cb6e31c4b2d2.tar.zst nixlib-32f6cfaae59ad1d1cb1338023015cb6e31c4b2d2.zip |
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')
-rw-r--r-- | maintainers/scripts/pluginupdate.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/maintainers/scripts/pluginupdate.py b/maintainers/scripts/pluginupdate.py index 7c6cfd4fed7f..f9ec19bed4ae 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) |