From a589a34d15e855523d6f65e1025d33d4593b8f3b Mon Sep 17 00:00:00 2001 From: strawberry Date: Sat, 15 Jun 2024 17:31:09 -0400 Subject: [PATCH] ci: unify/simplify documentation and ci nix steps Signed-off-by: strawberry --- .github/workflows/ci.yml | 3 ++ .github/workflows/documentation.yml | 60 ++++++++++++++--------------- 2 files changed, 31 insertions(+), 32 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa9f28a0..b9e3233c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,6 +64,9 @@ jobs: - name: Install Nix uses: DeterminateSystems/nix-installer-action@main + with: + diagnostic-endpoint: "" + extra-conf: "experimental-features = nix-command flakes" - name: Enable Cachix binary cache run: | diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 168ec6c8..da5b383a 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -31,7 +31,6 @@ concurrency: jobs: docs: name: Documentation and GitHub Pages - runs-on: ubuntu-latest permissions: @@ -50,52 +49,49 @@ jobs: if: github.event_name != 'pull_request' uses: actions/configure-pages@v5 - - name: Install Nix (with flakes and nix-command enabled) - uses: cachix/install-nix-action@v27 + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main with: - nix_path: nixpkgs=channel:nixos-unstable + diagnostic-endpoint: "" + extra-conf: "experimental-features = nix-command flakes" - # Add `nix-community`, Crane, upstream Conduit, and conduwuit binary caches - extra_nix_config: | - experimental-features = nix-command flakes - extra-substituters = https://nix-community.cachix.org - extra-trusted-public-keys = nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= - extra-substituters = https://crane.cachix.org - extra-trusted-public-keys = crane.cachix.org-1:8Scfpmn9w+hGdXH/Q9tTLiYAE/2dnJYRJP7kl80GuRk= - extra-substituters = https://attic.kennel.juneis.dog/conduit - extra-trusted-public-keys = conduit:eEKoUwlQGDdYmAI/Q/0slVlegqh/QmAvQd7HBSm21Wk= - extra-substituters = https://attic.kennel.juneis.dog/conduwuit - extra-trusted-public-keys = conduwuit:BbycGUgTISsltcmH0qNjFR9dbrQNYgdIAcmViSGoVTE= - - - name: Add alternative Nix binary caches if specified - if: ${{ (env.ATTIC_ENDPOINT != '') && (env.ATTIC_PUBLIC_KEY != '') }} + - name: Enable Cachix binary cache run: | - echo "extra-substituters = ${{ env.ATTIC_ENDPOINT }}" >> /etc/nix/nix.conf - echo "extra-trusted-public-keys = ${{ env.ATTIC_PUBLIC_KEY }}" >> /etc/nix/nix.conf + nix profile install nixpkgs#cachix + cachix use crane + cachix use nix-community - - name: Pop/push Magic Nix Cache + - name: Configure Magic Nix Cache uses: DeterminateSystems/magic-nix-cache-action@main with: diagnostic-endpoint: "" upstream-cache: "https://attic.kennel.juneis.dog" - - name: Configure `nix-direnv` + - name: Apply Nix binary cache configuration run: | - echo 'source $HOME/.nix-profile/share/nix-direnv/direnvrc' > "$HOME/.direnvrc" + sudo tee -a /etc/nix/nix.conf > /dev/null <" -iA direnv -iA nix-direnv + - name: Use alternative Nix binary caches if specified + if: ${{ (env.ATTIC_ENDPOINT != '') && (env.ATTIC_PUBLIC_KEY != '') }} + run: | + sudo tee -a /etc/nix/nix.conf > /dev/null < "$HOME/.direnvrc" + nix profile install --impure --inputs-from . nixpkgs#direnv nixpkgs#nix-direnv + direnv allow + nix develop --command true - name: Cache CI dependencies run: | - ./bin/nix-build-and-cache ci + bin/nix-build-and-cache ci - name: Build documentation (book) run: |