feat: enable pre-commit checks

main
mandlm 2024-07-10 13:40:41 +02:00
parent c2afb2c5d1
commit a13a15cbd9
Signed by: mandlm
GPG Key ID: 088ED38F036C7AF2
12 changed files with 110 additions and 26 deletions

8
.envrc Normal file
View File

@ -0,0 +1,8 @@
use flake .nix
if on_git_branch; then
echo
git status --short --branch
echo
git fetch
fi

1
.gitignore vendored
View File

@ -2,4 +2,3 @@
# Ignore build outputs from performing a nix-build or `nix build` command
result
result-*

25
.nix/flake.lock Normal file
View File

@ -0,0 +1,25 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1720418205,
"narHash": "sha256-cPJoFPXU44GlhWg4pUk9oUPqurPlCFZ11ZQPk21GTPU=",
"rev": "655a58a72a6601292512670343087c2d75d859c1",
"revCount": 650378,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.650378%2Brev-655a58a72a6601292512670343087c2d75d859c1/019095fe-96b2-7a7c-ad7c-2131b3fb6fa7/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.%2A.tar.gz"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

32
.nix/flake.nix Normal file
View File

@ -0,0 +1,32 @@
{
description = "A flake editing flake";
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
outputs = { nixpkgs, ... }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
in
{
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell.override
{
# Override stdenv in order to change compiler:
# stdenv = pkgs.clangStdenv;
}
{
packages = with pkgs; [
pre-commit
commitizen
];
shellHook = ''
pre-commit install --allow-missing-config --hook-type pre-commit --hook-type commit-msg
'';
};
});
};
}

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

@ -0,0 +1,27 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: detect-private-key
- id: mixed-line-ending
- repo: https://github.com/commitizen-tools/commitizen
rev: v3.27.0
hooks:
- id: commitizen
stages: [commit-msg]
- repo: local
hooks:
- id: home-manager-check
name: Home Manager Config Check
entry: home-manager switch --dry-run
language: system
pass_filenames: false
exclude: ^docs/

View File

@ -1,2 +1 @@
# home-manager

View File

@ -123,4 +123,3 @@
'')
];
}

View File

@ -62,4 +62,3 @@
};
};
}

View File

@ -169,5 +169,3 @@
};
};
}

View File

@ -5,4 +5,3 @@
enableZshIntegration = true;
};
}

View File

@ -6,4 +6,3 @@
enableZshIntegration = true;
};
}