1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-03 15:40:59 +01:00

Give unit tests access to a $HOME directory

Also, don't try to access cache.nixos.org in the libstore unit tests.
This commit is contained in:
Eelco Dolstra 2025-06-16 12:09:43 +02:00
parent 6bf997e0bd
commit 01388b3e78
5 changed files with 18 additions and 38 deletions

View file

@ -73,17 +73,13 @@ mkMesonExecutable (finalAttrs: {
{
meta.broken = !stdenv.hostPlatform.emulatorAvailable buildPackages;
}
(
lib.optionalString stdenv.hostPlatform.isWindows ''
export HOME="$PWD/home-dir"
mkdir -p "$HOME"
''
+ ''
export _NIX_TEST_UNIT_DATA=${data + "/src/libstore-tests/data"}
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
touch $out
''
);
(''
export _NIX_TEST_UNIT_DATA=${data + "/src/libstore-tests/data"}
export HOME="$TMPDIR/home"
mkdir -p "$HOME"
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
touch $out
'');
};
};