From 274a7be8d5d825bab510e3c06609fe7807b12680 Mon Sep 17 00:00:00 2001 From: regnat Date: Wed, 22 Sep 2021 10:23:00 +0200 Subject: [PATCH] Try to replicate as closely as possible the CI setup So that the hashes match --- .github/workflows/test.yml | 6 ++---- scripts/test-against-master.sh | 24 ++++++++++-------------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2ea874e31..4c7ca1d1a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,11 +22,9 @@ jobs: name: '${{ env.CACHIX_NAME }}' signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - run: cachix use nixos-nix-install-tests - run: nix-build -A checks.$(nix-instantiate --eval -E '(builtins.currentSystem)') - - run: | - cachix use nixos-nix-install-tests - CURRENT_NIX_BUILD=$(nix-build -A defaultPackage.$(nix-instantiate --eval -E '(builtins.currentSystem)'))/bin - PATH=$CURRENT_NIX_BUILD:$PATH GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} bash scripts/test-against-master.sh + - run: bash scripts/test-against-master.sh check_cachix: name: Cachix secret present for installer tests runs-on: ubuntu-latest diff --git a/scripts/test-against-master.sh b/scripts/test-against-master.sh index d7d09bae5..48e4c633c 100755 --- a/scripts/test-against-master.sh +++ b/scripts/test-against-master.sh @@ -6,7 +6,7 @@ set -x; CurrentNixDir=$(pwd) CurrentRev=${GITHUB_SHA:-$(git rev-parse HEAD)} WorkDir=$(mktemp -d) -trap 'rm -r "$WorkDir"' EXIT +trap 'rm -rf "$WorkDir"' EXIT GITHUB_TOKEN_OPTION=() if [[ -n "${GITHUB_TOKEN:-}" ]]; then GITHUB_TOKEN_OPTION=("--option" "access-tokens" "github.com=$GITHUB_TOKEN") @@ -14,20 +14,16 @@ fi pushd "$WorkDir" -cat < flake.nix -{ - inputs.currentNix.url = "git+file://$CurrentNixDir?rev=$CurrentRev"; - inputs.nixMaster.url = "github:nixos/nix"; +git clone "https://github.com/nixos/nix" - outputs = { self, currentNix, nixMaster }: { - checks = builtins.mapAttrs (systemName: _: - { againstMaster = currentNix.lib.testAgainst.\${systemName} nixMaster.defaultPackage.\${systemName}; } - ) currentNix.defaultPackage; - }; -} +cat < default.nix +let + currentNix = import $CurrentNixDir; + masterNix = import ./nix; +in +currentNix.lib.testAgainst.\${builtins.currentSystem} masterNix.defaultPackage.\${builtins.currentSystem} EOF -nix flake check\ - --experimental-features 'nix-command flakes' \ - "${GITHUB_TOKEN_OPTION[@]}" + +nix-build "${GITHUB_TOKEN_OPTION[@]}" popd