clan-cli: another try to fix the CI bug

This commit is contained in:
lassulus
2025-02-27 08:24:28 +01:00
parent cb13e7fab8
commit 60b22fdf0e
2 changed files with 6 additions and 4 deletions

View File

@@ -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

View File

@@ -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