cache nix_config

We often call this several times during execution.
At the moment we only use system at the moment, which is unlikely to
change.
This commit is contained in:
Jörg Thalheim
2025-04-14 12:54:27 +02:00
parent 126d1797c8
commit 268be9e1f3

View File

@@ -2,6 +2,7 @@ import json
import logging
import os
import tempfile
from functools import cache
from pathlib import Path
from typing import Any
@@ -51,6 +52,7 @@ def nix_add_to_gcroots(nix_path: Path, dest: Path) -> None:
run(cmd)
@cache
def nix_config() -> dict[str, Any]:
cmd = nix_command(["config", "show", "--json"])
proc = run_no_stdout(cmd)