From 60b22fdf0e7ec052630c882af0336069879e15de Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 27 Feb 2025 08:24:28 +0100 Subject: [PATCH] clan-cli: another try to fix the CI bug --- pkgs/clan-cli/clan_cli/nix/__init__.py | 7 ++++++- pkgs/clan-cli/default.nix | 3 --- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pkgs/clan-cli/clan_cli/nix/__init__.py b/pkgs/clan-cli/clan_cli/nix/__init__.py index 5c749951a..ad32e5d38 100644 --- a/pkgs/clan-cli/clan_cli/nix/__init__.py +++ b/pkgs/clan-cli/clan_cli/nix/__init__.py @@ -1,6 +1,7 @@ import json import logging import os +import tempfile from pathlib import Path from typing import Any @@ -62,11 +63,15 @@ def nix_config() -> dict[str, Any]: def nix_test_store() -> Path | None: store = os.environ.get("CLAN_TEST_STORE", None) + lock_nix = os.environ.get("LOCK_NIX", "") + + if not lock_nix: + lock_nix = tempfile.NamedTemporaryFile().name # NOQA: SIM115 if not os.environ.get("IN_NIX_SANDBOX"): return None if store: Path.mkdir(Path(store), exist_ok=True) - with locked_open(filename=Path(store) / "lockfile", mode="a"): + with locked_open(Path(lock_nix), "w"): return Path(store) return None diff --git a/pkgs/clan-cli/default.nix b/pkgs/clan-cli/default.nix index c6d42c9a8..95446fe0d 100644 --- a/pkgs/clan-cli/default.nix +++ b/pkgs/clan-cli/default.nix @@ -136,9 +136,6 @@ pythonRuntime.pkgs.buildPythonApplication { cd ./src export NIX_STATE_DIR=$TMPDIR/nix IN_NIX_SANDBOX=1 PYTHONWARNINGS=error - mkdir -p $TMPDIR/nix/var/nix/profiles - mkdir -p $TMPDIR/nix/var/nix/gcroots - ln -sfT $TMPDIR/nix/var/nix/profiles $TMPDIR/nix/var/nix/gcroots/profiles # required to prevent concurrent 'nix flake lock' operations export CLAN_TEST_STORE=$TMPDIR/store