nix-actions/default.nix

70 lines
1.2 KiB
Nix
Raw Normal View History

2024-11-11 16:29:36 +01:00
{
sources ? import ./npins,
pkgs ? import sources.nixpkgs { },
}:
let
inherit (pkgs) lib mkShell;
inherit (pkgs.lib.fileset) gitTracked toSource;
2024-11-11 16:29:36 +01:00
git-checks = (import sources.git-hooks).run {
src = ./.;
hooks = {
statix = {
enable = true;
stages = [ "pre-push" ];
settings.ignore = [ "npins" ];
};
deadnix = {
enable = true;
stages = [ "pre-push" ];
};
nixfmt-rfc-style = {
enable = true;
stages = [ "pre-push" ];
};
commitizen.enable = true;
};
};
in
{
devShell = mkShell {
name = "nix-actions.dev";
inherit (git-checks) shellHook;
};
install =
{ src, ... }@config:
2024-11-11 16:29:36 +01:00
let
project = lib.evalModules {
modules = [
./modules
{
config = (removeAttrs config [ "src" ]) // {
2024-11-11 16:29:36 +01:00
_module.args.pkgs = pkgs;
rootSrc = toSource {
root = src;
fileset = gitTracked src;
};
2024-11-11 16:29:36 +01:00
};
}
];
};
in
{
shellHook = project.config.installationScript;
};
2024-11-19 15:56:20 +01:00
lib = rec {
expr = repr: "\${{ ${repr} }}";
secret = name: expr "secrets.${name}";
};
2024-11-11 16:29:36 +01:00
}