2023-05-16 03:00:18 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
|
|
|
set -x
|
|
|
|
|
|
|
|
source common.sh
|
|
|
|
|
2023-07-13 19:39:46 +00:00
|
|
|
# Avoid store dir being inside sandbox build-dir
|
|
|
|
unset NIX_STORE_DIR
|
|
|
|
unset NIX_STATE_DIR
|
|
|
|
|
2023-12-11 18:30:40 +00:00
|
|
|
setupStoreDirs
|
2023-05-16 03:00:18 +00:00
|
|
|
|
|
|
|
initLowerStore
|
|
|
|
|
|
|
|
mountOverlayfs
|
|
|
|
|
|
|
|
### Do a build in overlay store
|
|
|
|
|
|
|
|
path=$(nix-build ../hermetic.nix --arg busybox $busybox --arg seed 2 --store "$storeB" --no-out-link)
|
|
|
|
|
|
|
|
# Checking for path in lower layer (should fail)
|
|
|
|
expect 1 stat $(toRealPath "$storeA/nix/store" "$path")
|
|
|
|
|
|
|
|
# Checking for path in upper layer
|
|
|
|
stat $(toRealPath "$storeBTop" "$path")
|
|
|
|
|
|
|
|
# Verifying path in overlay store
|
|
|
|
nix-store --verify-path --store "$storeB" "$path"
|