added pre-commit hooks

This commit is contained in:
Sebastian Wendel 2022-08-01 14:36:57 +02:00
parent eb9fe1b939
commit e3cd75780d
No known key found for this signature in database
GPG key ID: 1422B7DF78144640
4 changed files with 41 additions and 20 deletions

17
.envrc
View file

@ -1,16 +1,7 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.1.1; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.1.1/direnvrc" "sha256-b6qJ4r34rbE23yWjMqbmu3ia2z4b2wIlZUksBke/ol0="
fi
watch_file **/*.nix
watch_file flake.lock
use flake
if (nix help flake &> /dev/null)
then
use flake
watch_file ./nix/checks.nix
watch_file ./nix/dev-shell.nix
else
use nix
fi
eval "$shellHook"
eval "$shellHook"

1
.gitignore vendored
View file

@ -2,7 +2,6 @@
.*.swp
.direnv
.DS_Store
.pre-commit-config.yaml
*.tgz
/.idea/*
.vscode/*.log

27
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,27 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-added-large-files
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: check-json
- id: check-merge-conflict
- id: check-yaml
- id: detect-private-key
- id: double-quote-string-fixer
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/crate-ci/typos
rev: v1.10.3
hooks:
- id: typos
- repo: https://github.com/adrienverge/yamllint
rev: v1.27.1
hooks:
- id: yamllint
files: '.*(?<!\.yaml)$'

View file

@ -9,10 +9,14 @@
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... }@inputs:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system}; in
{
devShells.default = import ./shell.nix { inherit pkgs; };
}
);
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
allowBroken = true;
};
};
in { devShells.default = import ./shell.nix { inherit pkgs; }; });
}