Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: automate updating flake inputs #34

Closed
wants to merge 13 commits into from
73 changes: 73 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Build all Nix configurations
on:
pull_request:
branches: [master]
push:
branches: [master]
workflow_dispatch:

jobs:

test_nixos_builds:
name: Build NixOS configurations
runs-on: ubuntu-latest
container:
image: nixos/nix:latest
env:
NIX_EXPERIMENTAL_FEATURES: "nix-command flakes"
steps:
- uses: actions/checkout@v4
- uses: cachix/cachix-action@v12
with:
name: davsanchez
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Build Darwin VM
run: nixos-rebuild build --flake .#darwinVM
- name: Build UTM VM
run: nixos-rebuild build --flake .#nr-vm-utm

test_darwin_builds:
name: Build Darwin configurations
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v7
- uses: cachix/cachix-action@v12
with:
name: davsanchez
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Install nix-darwin
run: nix run nix-darwin -- switch --flake .#mbp
- name: Build Darwin MBP
run: darwin-rebuild build --flake .#mbp
- name: Build Darwin Mini
run: darwin-rebuild build --flake .#mini

test_home_manager_builds:
name: Build Home Manager configurations
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v7
- uses: cachix/cachix-action@v12
with:
name: davsanchez
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Install home-manager
run: nix run home-manager/master -- init --switch
- name: Build Home Manager david@mbp
if: ${{ matrix.os == 'macos-latest' }}
run: home-manager build --flake ".#david@mbp"
- name: Build Home Manager david@mini
if: ${{ matrix.os == 'macos-latest' }}
run: home-manager build --flake ".#david@mini"
- name: Build Home Manager davidsanchez@nr-vm
if: ${{ matrix.os == 'ubuntu-latest' }}
run: home-manager build --flake ".#davidsanchez@nr-vm"
34 changes: 34 additions & 0 deletions .github/workflows/update-flake-inputs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Update flake inputs
on:
schedule:
# 1st and 15th of each month at midnight UTC
- cron: '0 0 1,15 * *'
workflow_dispatch:

jobs:

update_flake_inputs:
name: Update flake inputs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up git user
run: |
git config --global user.name 'DavSanchez's GitHub Actions'
git config --global user.email '[email protected]
- name: Checkout a new branch
run: git switch -c chore/update-flake-inputs
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v7
- name: Update flake inputs
run: nix flake update --commit-lock-file
- name: Create Pull Request using GH CLI
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create --title "chore: update flake inputs" --body "Update flake inputs"
- name: Set branch for auto-merge
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr merge --squash --auto --delete-branch

30 changes: 15 additions & 15 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion home-manager/features/dev/devops.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
]
++ lib.optionals pkgs.stdenv.isDarwin [
## Container runtimes on macOS
colima
colima # Containers
tart # VMs
];

programs = {
Expand Down
6 changes: 2 additions & 4 deletions hosts/darwin/mbp.nix
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
"maccy"
"openemu"
"openra"
"proton-drive"
"protonmail-bridge"
"protonvpn"
"qflipper"
Expand All @@ -183,10 +184,7 @@
"yacreader"
"zed"
];
brews = [
"ghcup"
"tart"
];
brews = [];
masApps = {
"1Blocker" = 1365531024;
"Amphetamine" = 937984704;
Expand Down
6 changes: 2 additions & 4 deletions hosts/darwin/mini.nix
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
"openemu"
"openra"
"plex-media-server"
"proton-drive"
"protonmail-bridge"
"protonvpn"
"qflipper"
Expand All @@ -190,10 +191,7 @@
"zed"
"zotero"
];
brews = [
"ghcup"
"tart"
];
brews = [];
masApps = {
"1Blocker" = 1365531024;
"Amphetamine" = 937984704;
Expand Down
5 changes: 1 addition & 4 deletions hosts/darwin/nr.nix
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,7 @@
"warp"
"wireshark"
];
brews = [
"ghcup"
"tart" # VMs on Apple Silicon
];
brews = [];
masApps = {
"1Blocker" = 1365531024;
"1Password for Safari" = 1569813296;
Expand Down
Loading