-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #200 from mjhoy/automatically-update-nixpkgs
automatically update nixpkgs
- Loading branch information
Showing
4 changed files
with
69 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |