From 7dc070b36f52c053cfd6bc833c045e5ea477aa3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 14 Apr 2025 12:54:27 +0200 Subject: [PATCH] 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. --- pkgs/clan-cli/clan_cli/nix/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/clan-cli/clan_cli/nix/__init__.py b/pkgs/clan-cli/clan_cli/nix/__init__.py index ad32e5d38..4678b1f8b 100644 --- a/pkgs/clan-cli/clan_cli/nix/__init__.py +++ b/pkgs/clan-cli/clan_cli/nix/__init__.py @@ -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)