2024-11-11 16:29:36 +01:00
|
|
|
{
|
|
|
|
sources ? import ./npins,
|
|
|
|
pkgs ? import sources.nixpkgs { },
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
inherit (pkgs) lib mkShell;
|
|
|
|
|
2024-11-11 17:18:38 +01:00
|
|
|
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 =
|
2024-11-11 17:18:38 +01:00
|
|
|
{ src, ... }@config:
|
2024-11-11 16:29:36 +01:00
|
|
|
let
|
|
|
|
project = lib.evalModules {
|
|
|
|
modules = [
|
|
|
|
./modules
|
|
|
|
{
|
2024-11-11 17:18:38 +01:00
|
|
|
config = (removeAttrs config [ "src" ]) // {
|
2024-11-11 16:29:36 +01:00
|
|
|
_module.args.pkgs = pkgs;
|
2024-11-11 17:18:38 +01:00
|
|
|
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-19 15:56:46 +01:00
|
|
|
|
|
|
|
steps =
|
|
|
|
{
|
|
|
|
__functor =
|
|
|
|
self:
|
|
|
|
{
|
|
|
|
name,
|
|
|
|
url,
|
|
|
|
defaultVersion,
|
|
|
|
}:
|
|
|
|
self
|
|
|
|
// {
|
|
|
|
${name} =
|
|
|
|
{
|
|
|
|
__version ? defaultVersion,
|
|
|
|
...
|
|
|
|
}@args:
|
|
|
|
{
|
|
|
|
uses = "${url}@${__version}";
|
|
|
|
"with" = builtins.removeAttrs args [ "__version" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "checkout";
|
|
|
|
defaultVersion = "v3";
|
|
|
|
url = "actions/checkout";
|
|
|
|
};
|
2024-11-11 16:29:36 +01:00
|
|
|
}
|