From 279a263ca88f2c058907f4a1f7eb10486c626499 Mon Sep 17 00:00:00 2001 From: nyiyui <+@nyiyui.ca> Date: Mon, 5 Aug 2024 10:32:23 +0900 Subject: [PATCH] nix flake update and github actions for that --- .github/workflows/nix-flake-update.yml | 22 ++++++++++++++++++++++ .github/workflows/nixfmt.yml | 22 ++++++++++++++++++++++ flake.lock | 6 +++--- flake.nix | 1 + 4 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/nix-flake-update.yml create mode 100644 .github/workflows/nixfmt.yml diff --git a/.github/workflows/nix-flake-update.yml b/.github/workflows/nix-flake-update.yml new file mode 100644 index 0000000..18b74d9 --- /dev/null +++ b/.github/workflows/nix-flake-update.yml @@ -0,0 +1,22 @@ +name: nix flake update +on: + schedule: + - cron: "0 0 * * 5" + workflow_dispatch: + +jobs: + update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v20 + with: + gitub_access_token: ${{ secrets.GITHUB_TOKEN }} + - run: nix flake update + - name: commit and push + run: | + git config user.name 'GitHub Actions' + git config user.email 'github-actions@nyiyui.ca' + git add flake.lock + git commit -am "nix flake update" + git push diff --git a/.github/workflows/nixfmt.yml b/.github/workflows/nixfmt.yml new file mode 100644 index 0000000..a27a43a --- /dev/null +++ b/.github/workflows/nixfmt.yml @@ -0,0 +1,22 @@ +name: nixfmt +on: + push: + +jobs: + update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v20 + - run: "nix develop --command nixfmt */*.nix" + - name: commit and push + run: | + if git diff --exit-code; then + echo 'no changes!' + else + git config user.name 'GitHub Actions' + git config user.email 'github-actions@nyiyui.ca' + git add . + git commit -am "nixfmt" + git push + fi diff --git a/flake.lock b/flake.lock index b1f07f5..6d8215d 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1720368505, - "narHash": "sha256-5r0pInVo5d6Enti0YwUSQK4TebITypB42bWy5su3MrQ=", + "lastModified": 1722640603, + "narHash": "sha256-TcXjLVNd3VeH1qKPH335Tc4RbFDbZQX+d7rqnDUoRaY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ab82a9612aa45284d4adf69ee81871a389669a9e", + "rev": "81610abc161d4021b29199aa464d6a1a521e0cc9", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 24a93eb..f113ea7 100644 --- a/flake.nix +++ b/flake.nix @@ -55,6 +55,7 @@ nixfmt-rfc-style govulncheck nix-prefetch + act ]; }; };