From 9a09787ad94618fe7bf03bf190cc027e182ddb7a Mon Sep 17 00:00:00 2001 From: Mikey Hoy Date: Fri, 3 Nov 2023 08:41:01 -0400 Subject: [PATCH 1/4] update build-nix-env to use nix-env -f option in the github runners, this seems to work, whereas `nixpkgs.` did not. not actually sure why! --- scripts/build-nix-env | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/build-nix-env b/scripts/build-nix-env index 454ca958..c32b65f2 100755 --- a/scripts/build-nix-env +++ b/scripts/build-nix-env @@ -7,11 +7,11 @@ set -eoux pipefail echo "Building devEnv" -nix-build --no-link --show-trace -A devEnv '' +nix-build --no-link --show-trace '' -A devEnv echo "Building nix" -nix-build --no-link -A nix '' +nix-build --no-link '' -A nix echo "Installing" -nix-env -iA nixpkgs.devEnv -nix-env -iA nixpkgs.nix +nix-env -f '' -i devEnv +nix-env -f '' -i nix From 1840da73f2978af43727d815da240ffc1b22fb66 Mon Sep 17 00:00:00 2001 From: Mikey Hoy Date: Fri, 3 Nov 2023 08:41:55 -0400 Subject: [PATCH 2/4] update build step to use newer checkout version --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4e1e4afa..6b377f55 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,7 +5,7 @@ jobs: build: runs-on: macos-latest steps: - - uses: actions/checkout@v2.3.4 + - uses: actions/checkout@v4 with: submodules: true - uses: cachix/install-nix-action@v22 From baff9874b9c3f573282b470bb6b73424e9d425de Mon Sep 17 00:00:00 2001 From: Mikey Hoy Date: Fri, 3 Nov 2023 08:42:08 -0400 Subject: [PATCH 3/4] add update-nixpkgs script --- scripts/update-nixpkgs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 scripts/update-nixpkgs diff --git a/scripts/update-nixpkgs b/scripts/update-nixpkgs new file mode 100755 index 00000000..48ddc15e --- /dev/null +++ b/scripts/update-nixpkgs @@ -0,0 +1,38 @@ +#!/bin/bash +# +# This script does the following: +# +# 1. Updates `nixpkgs` reference using `niv` +# 2. Updates the commit referenced in nix/nixpkgs/overlays.nix +# 3. Commits changes and opens a github PR + +set -eou pipefail + +if [ -n "$(git status --porcelain)" ]; then + echo "git status dirty; exiting"; + exit 1 +fi + +DATE=$(date "+%Y-%m-%d") + +BRANCH_NAME=update-nixpkgs-$DATE + +git checkout -b $BRANCH_NAME + +niv update nixpkgs + +git add nix/sources.json + +git commit -m "update nixpkgs $DATE" + +LATEST_EMACS_REF=$(gh api /repos/nix-community/emacs-overlay/git/ref/heads/master | jq -r '.object.sha') + +sed -i '' -e "s|emacs-overlay/archive/.*|emacs-overlay/archive/$LATEST_EMACS_REF.tar.gz;|g" nix/nixpkgs/overlays.nix + +git add nix/nixpkgs/overlays.nix + +git commit -m "update emacs overlay $DATE" + +git push origin $BRANCH_NAME -u + +gh pr create --title "update nixpkgs $DATE" --body "generated by scripts/update-nixpkgs" From 4d701928d430e6bec6f32b818f2f7c0d651a5c16 Mon Sep 17 00:00:00 2001 From: Mikey Hoy Date: Fri, 3 Nov 2023 08:42:13 -0400 Subject: [PATCH 4/4] add update scheduled action --- .github/workflows/update.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/update.yml diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml new file mode 100644 index 00000000..28485978 --- /dev/null +++ b/.github/workflows/update.yml @@ -0,0 +1,26 @@ +name: "Update" +on: + schedule: + # Every monday at 9 UTC + - cron: '0 9 * * 1' +jobs: + update: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - uses: cachix/install-nix-action@v22 + with: + nix_path: nixpkgs=${{ github.workspace }}/nixpkgs + install_url: https://releases.nixos.org/nix/nix-2.8.1/install + - run: make install + - uses: cachix/cachix-action@v12 + with: + name: mjhoy + signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' + extraPullNames: nix-community + - run: ./scripts/build-nix-env + - run: ./scripts/update-nixpkgs + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}