ci: add flake test

- Check flake
- Check nixos-search doc generation
This commit is contained in:
Erik Arvstedt 2021-12-10 14:07:58 +01:00
parent d3c8d7bd6f
commit 1ef40ac230
No known key found for this signature in database
GPG Key ID: 33312B944DD97846
3 changed files with 34 additions and 0 deletions

View File

@ -29,3 +29,10 @@ task:
- echo "sandbox = true" >> /etc/nix/nix.conf - echo "sandbox = true" >> /etc/nix/nix.conf
- export NIX_PATH="nixpkgs=$(nix eval --raw -f pkgs/nixpkgs-pinned.nix nixpkgs)" - export NIX_PATH="nixpkgs=$(nix eval --raw -f pkgs/nixpkgs-pinned.nix nixpkgs)"
- nix run -f '<nixpkgs>' bash coreutils cachix -c ./test/ci/build.sh - nix run -f '<nixpkgs>' bash coreutils cachix -c ./test/ci/build.sh
- name: flake
container:
image: nixpkgs/nix-flakes
build_script:
- nix flake check
- ./test/nixos-search/ci-test.sh

23
test/nixos-search/ci-test.sh Executable file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -euo pipefail
cd "${BASH_SOURCE[0]%/*}"
# Use cachix to cache the `flake-info` build
cachixCache=nix-bitcoin
nix run .#cachix -- use $cachixCache
# We're running in a basic, unprivileged container that doesn't support sandboxing.
# Sandboxing is unnneeded because we're only building the 3rd-party `flake-info` tool.
echo "sandbox = false" >> /etc/nix/nix.conf
export PATH=$(nix shell -L .#flake-info .#cachix -c sh -c 'echo $PATH')
if [[ ${CACHIX_SIGNING_KEY:-} ]]; then
cachix push $cachixCache $(type -P flake-info);
fi
# flake-info requires '<nixpkgs>'
export NIX_PATH=nixpkgs=$(nix eval --raw .#nixpkgsPath)
echo "Running flake-info (nixos-search)"
flake-info flake ./.

View File

@ -5,5 +5,9 @@
inputs.nixos-search.url = "github:nixos/nixos-search"; inputs.nixos-search.url = "github:nixos/nixos-search";
outputs = { self, nixos-search }: { outputs = { self, nixos-search }: {
inherit (nixos-search) packages; inherit (nixos-search) packages;
# Used by ./ci-test.sh
inherit (nixos-search.inputs.nixpkgs) legacyPackages;
nixpkgsPath = toString nixos-search.inputs.nixpkgs;
}; };
} }