mirror of
https://github.com/ryanccn/flake.git
synced 2025-12-06 00:00:44 +01:00
49 lines
1 KiB
Nix
49 lines
1 KiB
Nix
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
{ self, ... }:
|
|
{
|
|
perSystem =
|
|
{ pkgs, config, ... }:
|
|
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 ];
|
|
};
|
|
};
|
|
};
|
|
}
|