45 lines
1 KiB
Nix
45 lines
1 KiB
Nix
|
# SPDX-FileCopyrightText: 2024 Simon Bruder <simon@sbruder.de>
|
||
|
#
|
||
|
# SPDX-License-Identifier: Apache-2.0
|
||
|
|
||
|
{
|
||
|
inputs = {
|
||
|
flake-utils.url = "github:numtide/flake-utils";
|
||
|
|
||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||
|
|
||
|
git-hooks.url = "github:cachix/git-hooks.nix";
|
||
|
};
|
||
|
|
||
|
outputs = { self, flake-utils, nixpkgs, git-hooks }: flake-utils.lib.eachDefaultSystem (system:
|
||
|
let
|
||
|
pkgs = import nixpkgs { inherit system; };
|
||
|
in
|
||
|
{
|
||
|
checks = {
|
||
|
pre-commit-check = git-hooks.lib.${system}.run {
|
||
|
src = self;
|
||
|
hooks = {
|
||
|
nixpkgs-fmt.enable = true;
|
||
|
reuse = {
|
||
|
enable = true;
|
||
|
name = "reuse";
|
||
|
entry = "reuse lint";
|
||
|
pass_filenames = false;
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
|
||
|
devShells.default = pkgs.mkShell {
|
||
|
buildInputs = with pkgs; [
|
||
|
reuse
|
||
|
];
|
||
|
|
||
|
shellHook = ''
|
||
|
${self.checks.${system}.pre-commit-check.shellHook}
|
||
|
'';
|
||
|
};
|
||
|
});
|
||
|
}
|