Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# devenv
.devenv.flake.nix -merge linguist-generated
devenv.lock -merge linguist-generated
46 changes: 46 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Lint
on:
push:
pull_request:
workflow_dispatch:

permissions: {}

jobs:
prek:
runs-on: ubuntu-latest
steps:
- name: Download source
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
fetch-depth: 0
- uses: cachix/install-nix-action@4e002c8ec80594ecd40e759629461e26c8abed15 # v31
- uses: cachix/cachix-action@3ba601ff5bbb07c7220846facfa2cd81eeee15a1 # v16
with:
name: devenv
- name: Install devenv.sh
run: nix profile install nixpkgs#devenv
- name: "Download target branch: ${{ github.base_ref || 'master' }}"
run: git fetch origin "${TARGET_BRANCH}"
- name: Check whether to run full test on all files
id: test_full_run
if: ${{ github.event_name != 'workflow_dispatch' }}
run: |
# Trigger full run if devenv.lock or this workflow file changed
if git diff --quiet "origin/${TARGET_BRANCH}" HEAD -- devenv.lock .github/workflows/lint.yml; then
echo "test_full_run=false" >> "$GITHUB_OUTPUT"
else
echo "test_full_run=true" >> "$GITHUB_OUTPUT"
fi
- name: Run prek on all files
id: run_full
run: prek run --all-files
shell: devenv shell bash -- -e {0}
if: ${{ github.event_name == 'workflow_dispatch' || steps.test_full_run.outputs.test_full_run == 'true' }}
- name: Run prek hooks for changes against target branch (${{ github.base_ref || 'master' }})
run: prek run --from-ref "origin/${TARGET_BRANCH}" --to-ref HEAD
shell: devenv shell bash -- -e {0}
if: "${{ steps.run_full.outcome == 'skipped' }}"
env:
TARGET_BRANCH: "${{ github.base_ref || 'master' }}"
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Environment configuration
Makefile.local
Makefile.win.local
.env
.env.*
.envrc
.envrc.*

# Devenv
.devenv*
devenv.local.nix
devenv.local.yaml

# direnv
.direnv

# pre-commit
.pre-commit-config.yaml
139 changes: 139 additions & 0 deletions devenv.lock

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

18 changes: 18 additions & 0 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{ pkgs, lib, config, inputs, ... }:

{
git-hooks.hooks = {
actionlint.enable = true;
check-toml.enable = true;
check-vcs-permalinks.enable = true;
markdownlint.enable = true;
shellcheck = {
enable = true;
excludes = [
".*\.zsh$"
];
};
typos.enable = true;
zizmor.enable = true;
};
}
5 changes: 5 additions & 0 deletions devenv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
inputs:
git-hooks:
url: github:cachix/git-hooks.nix
nixpkgs:
url: github:cachix/devenv-nixpkgs/rolling