Merge fort-nix/nix-bitcoin#551: tests: Reenable flake-info
277510c7ee
tests: run flake-info in sandbox (Erik Arvstedt)d3b7e8c432
revert "tests: disable `nixosSearch`" (Erik Arvstedt) Pull request description: ACKs for top commit: jonasnick: ACK277510c7ee
Tree-SHA512: 2d242aeb65c65c4c3905cc66959092c1da923b9de9ce08ee68319b6475f4fd6f6148b5ac5ca312462b1fb38e8fc61706361f58886afc5052f65a18fb7a61de60
This commit is contained in:
commit
a7357c1176
@ -35,6 +35,7 @@ task:
|
||||
- name: flake
|
||||
build_script:
|
||||
- nix flake check
|
||||
- ./test/nixos-search/ci-test.sh
|
||||
|
||||
- name: shellcheck
|
||||
build_script:
|
||||
|
@ -53,6 +53,8 @@ Hint: To show a table of contents, click the button (![Github TOC button](docs/i
|
||||
top left corner of the documents.
|
||||
|
||||
<!-- TODO-EXTERNAL: -->
|
||||
<!-- Change query to `nix-bitcoin` when upstream search has been fixed -->
|
||||
* [NixOS options search](https://search.nixos.org/flakes?channel=unstable&sort=relevance&type=options&query=bitcoin)
|
||||
* [Hardware requirements](docs/hardware.md)
|
||||
* [Installation](docs/install.md)
|
||||
* [Configuration and maintenance](docs/configuration.md)
|
||||
|
44
test/nixos-search/flake-info-sandboxed.sh
Executable file
44
test/nixos-search/flake-info-sandboxed.sh
Executable file
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Run flake-info for the nix-bitcoin flake in a sandbox:
|
||||
# - Adds a consistent, reproducible runtime environment
|
||||
# - Removes the need to trust the flake-info binary
|
||||
#
|
||||
# Use bubblewrap instead of a sandboxed Nix build so that we don't have to copy
|
||||
# the whole repo to the sandbox when running this test.
|
||||
|
||||
cd "${BASH_SOURCE[0]%/*}"
|
||||
|
||||
nbFlake=$(realpath ../..)
|
||||
|
||||
# shellcheck disable=SC2016
|
||||
PATH=$(nix shell -L .#{flake-info,bubblewrap} -c sh -c 'echo $PATH')
|
||||
|
||||
tmpDir=$(mktemp -d /tmp/nix-bitcoin-flake-info.XXX)
|
||||
trap 'rm -rf $tmpDir' EXIT
|
||||
|
||||
echo '
|
||||
experimental-features = nix-command flakes
|
||||
flake-registry = /dev/null
|
||||
' > "$tmpDir/nix.conf"
|
||||
|
||||
echo "Running flake-info (nixos-search)"
|
||||
|
||||
bwrap \
|
||||
--unshare-all \
|
||||
--clearenv \
|
||||
--setenv PATH "$PATH" \
|
||||
--setenv NIX_PATH "$NIX_PATH" \
|
||||
--bind "$tmpDir" / \
|
||||
--proc /proc \
|
||||
--dev /dev \
|
||||
--tmpfs /tmp \
|
||||
--ro-bind "$nbFlake" "$nbFlake" \
|
||||
--ro-bind /nix /nix \
|
||||
--ro-bind /etc /etc \
|
||||
--tmpfs /etc/nix \
|
||||
--ro-bind "$tmpDir/nix.conf" /etc/nix/nix.conf \
|
||||
--ro-bind /usr /usr \
|
||||
--ro-bind-try /run /run \
|
||||
-- flake-info flake "$nbFlake"
|
@ -275,11 +275,6 @@ flake() {
|
||||
|
||||
# Test generating module documentation for search.nixos.org
|
||||
nixosSearch() {
|
||||
# TODO-EXTERNAL:
|
||||
# Remove this when nixos-search has been fixed
|
||||
echo "Skipping test nixosSearch"
|
||||
return
|
||||
|
||||
if ! checkFlakeSupport "nixosSearch"; then return; fi
|
||||
|
||||
if [[ $_nixBitcoinInCopiedSrc ]]; then
|
||||
@ -291,8 +286,7 @@ nixosSearch() {
|
||||
# Add gcroots for flake-info
|
||||
nix build "$scriptDir/nixos-search#flake-info" -o "$outLinkPrefix-flake-info"
|
||||
fi
|
||||
echo "Running flake-info (nixos-search)"
|
||||
nix run "$scriptDir/nixos-search#flake-info" -- flake "$scriptDir/.."
|
||||
"$scriptDir/nixos-search/flake-info-sandboxed.sh"
|
||||
}
|
||||
|
||||
# A basic subset of tests to keep the total runtime within
|
||||
|
Loading…
Reference in New Issue
Block a user