1
0
Fork 0
mirror of https://github.com/ryanccn/flake.git synced 2025-12-06 08:10:43 +01:00
flake/checks/default.nix
2025-08-15 18:22:33 +08:00

51 lines
1 KiB
Nix

# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
#
# SPDX-License-Identifier: Apache-2.0
{ self, ... }:
{
perSystem =
{ pkgs, ... }:
let
mkFlakeCheck =
args:
pkgs.stdenv.mkDerivation (
{
name = "check-${args.name}";
src = self;
buildPhase = ''
${args.command}
touch "$out"
'';
doCheck = false;
dontInstall = true;
dontFixup = true;
}
// (removeAttrs args [
"name"
"command"
])
);
in
{
checks = {
nixfmt = mkFlakeCheck {
name = "nixfmt";
command = "find . -name '*.nix' -exec nixfmt --check {} +";
nativeBuildInputs = with pkgs; [ nixfmt-rfc-style ];
};
reuse = mkFlakeCheck {
name = "reuse";
command = "reuse lint";
nativeBuildInputs = with pkgs; [ reuse ];
};
};
formatter = pkgs.nixfmt-rfc-style;
};
}