From 778156072444fdd06812b89e86169bf45f2425df Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 7 Jul 2025 11:26:06 +0200 Subject: [PATCH] libstore-tests: Fix impurity trying to access the Nix daemon This failed on macOS: nix-store-tests-run> C++ exception with description "../nix_api_store.cc:33: nix_err_code(ctx) != NIX_OK, message: error: getting status of '/nix/var/nix/daemon-socket/socket': Operation not permitted" thrown in the test body. --- src/libstore-tests/meson.build | 1 + src/libstore-tests/package.nix | 1 + 2 files changed, 2 insertions(+) diff --git a/src/libstore-tests/meson.build b/src/libstore-tests/meson.build index 8b9893b23..79f21620e 100644 --- a/src/libstore-tests/meson.build +++ b/src/libstore-tests/meson.build @@ -101,6 +101,7 @@ test( env : { '_NIX_TEST_UNIT_DATA': meson.current_source_dir() / 'data', 'HOME': meson.current_build_dir() / 'test-home', + 'NIX_REMOTE': meson.current_build_dir() / 'test-home' / 'store', }, protocol : 'gtest', ) diff --git a/src/libstore-tests/package.nix b/src/libstore-tests/package.nix index 62c7e136b..f606604ba 100644 --- a/src/libstore-tests/package.nix +++ b/src/libstore-tests/package.nix @@ -77,6 +77,7 @@ mkMesonExecutable (finalAttrs: { } ('' export _NIX_TEST_UNIT_DATA=${data + "/src/libstore-tests/data"} + export NIX_REMOTE=$HOME/store ${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage} touch $out '');