enable auto PRs and checks

This commit is contained in:
Noah Masur 2023-07-29 15:20:14 -04:00
parent 200f790ea1
commit b589ba5d8a
5 changed files with 75 additions and 6 deletions

21
.github/workflows/check.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: Check Build
on:
workflow_dispatch: # allows manual triggering
pull_request:
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v4
- name: Check Nixpkgs Inputs
uses: DeterminateSystems/flake-checker-action@v5
- name: Add Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v2
- name: Check the Flake
run: nix flake check

32
.github/workflows/update.yml vendored Normal file
View File

@ -0,0 +1,32 @@
name: Update Flake
on:
workflow_dispatch: # allows manual triggering
schedule:
- cron: '33 3 * * 0' # runs weekly on Sunday at 03:33
permissions:
contents: read
pull-request: write
jobs:
lockfile:
name: Lockfile
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v4
- name: Check Nixpkgs Inputs
uses: DeterminateSystems/flake-checker-action@v5
- name: Update flake.lock
uses: DeterminateSystems/update-flake-lock@v3
id: update
with:
pr-title: "Update flake.lock" # Title of PR to be created
pr-labels: | # Labels to be set on the PR
dependencies
automated
- name: Enable Pull Request Automerge
run: gh pr merge --merge --auto ${{ steps.update.outputs.pull-request-number }}

View File

@ -228,6 +228,24 @@
}); });
checks = forAllSystems (system:
let pkgs = import nixpkgs { inherit system overlays; };
in {
neovim = pkgs.runCommand "neovim-check-health" {
buildInputs = [ inputs.self.packages.${system}.neovim ];
} ''
mkdir -p $out
export HOME=$TMPDIR
nvim -c "checkhealth" -c "write $out/health.log" -c "quitall"
# Check for errors inside the health log
if $(grep "ERROR" $out/health.log); then
cat $out/health.log
exit 1
fi
'';
});
# Templates for starting other projects quickly # Templates for starting other projects quickly
templates = rec { templates = rec {
default = basic; default = basic;

View File

@ -4,14 +4,10 @@ inputs.nixos-generators.nixosGenerate {
inherit system; inherit system;
format = "amazon"; format = "amazon";
modules = [ modules = [
globals
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
{ {
nixpkgs.overlays = overlays; nixpkgs.overlays = overlays;
user = globals.user;
fullName = globals.fullName;
dotfilesRepo = globals.dotfilesRepo;
gitName = globals.gitName;
gitEmail = globals.gitEmail;
networking.hostName = "sheep"; networking.hostName = "sheep";
gui.enable = false; gui.enable = false;
theme.colors = (import ../../colorscheme/gruvbox).dark; theme.colors = (import ../../colorscheme/gruvbox).dark;

View File

@ -5,12 +5,14 @@
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
programs.msmtp.enable = true; programs.msmtp.enable = true;
# The system user for sending automatic notifications
accounts.email.accounts.system = accounts.email.accounts.system =
let address = "system@${config.mail.server}"; let address = "system@${config.mail.server}";
in { in {
userName = address; userName = address;
realName = "NixOS System"; realName = "NixOS System";
primary = false; primary = !config.mail.enable; # Only primary if mail not enabled
inherit address; inherit address;
passwordCommand = passwordCommand =
"${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${ "${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${