From cb89fb0847e02513a8383309b29cbd20e415482a Mon Sep 17 00:00:00 2001 From: Pablo Ovelleiro Corral Date: Sun, 16 Feb 2025 15:22:12 +0100 Subject: [PATCH] Fix locking --- pkgs/clan-cli/clan_cli/nix/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/clan-cli/clan_cli/nix/__init__.py b/pkgs/clan-cli/clan_cli/nix/__init__.py index 6ac7243ac..e4593b659 100644 --- a/pkgs/clan-cli/clan_cli/nix/__init__.py +++ b/pkgs/clan-cli/clan_cli/nix/__init__.py @@ -3,6 +3,7 @@ import logging import os from pathlib import Path from typing import Any +from clan_cli.locked_open import locked_open from clan_cli.cmd import run, run_no_stdout from clan_cli.dirs import nixpkgs_flake, nixpkgs_source @@ -60,11 +61,12 @@ def nix_config() -> dict[str, Any]: def nix_test_store() -> Path | None: + store = os.environ.get("CLAN_TEST_STORE", None) if not os.environ.get("IN_NIX_SANDBOX"): return None - store = os.environ.get("CLAN_TEST_STORE", None) if store: - return Path(store) + with locked_open(Path(store) / "lockfile"): + return Path(store) return None