crane/extra-tests/dummy-does-not-depend-on-flake-source-via-path/test.sh
Ivan Petkov 6f7504ad93
Drop dependency on nixpkgs (#692)
Callers should use `mkLib` with an instantiation of `pkgs` instead of
using `crane.lib.${system}` directly
2024-08-29 23:29:16 +00:00

24 lines
794 B
Bash
Executable File

#!/bin/sh
set -eu
scriptDir=$(dirname "$0")
cd "${scriptDir}"
nixpkgsOverride="$(../../ci/ref-from-lock.sh ../../test#nixpkgs)"
craneOverride="--override-input crane ../.. --override-input nixpkgs ${nixpkgsOverride}"
flakeSrc=$(nix flake metadata ${craneOverride} --json 2>/dev/null | jq -r '.path')
# Get information about the default derivation
# Then pull out any input sources
drvSrcs=$(nix show-derivation ${craneOverride} '.#dummy' 2>/dev/null |
jq -r 'to_entries[].value.inputSrcs[]')
# And lastly make sure we DO NOT find the flake root source listed
# or else the dummy derivation will depend on _too much_ (and get
# invalidated with irrelevant changes)
if echo "${drvSrcs}" | grep -q -F "${flakeSrc}"; then
echo "error: dummy derivation depends on flake source"
exit 1
fi