mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-12-12 01:42:02 +01:00
3c40bda301
Signed-off-by: magic_rb <magic_rb@redalder.org>
43 lines
834 B
Nix
43 lines
834 B
Nix
{
|
|
lib,
|
|
config,
|
|
inputs,
|
|
pkgs,
|
|
...
|
|
}: let
|
|
inherit
|
|
(lib)
|
|
mkIf
|
|
mkOption
|
|
types
|
|
pipe
|
|
concatStringsSep
|
|
getExe
|
|
;
|
|
cfg = config.hooks.ip-search;
|
|
in {
|
|
options.hooks.ip-search = {
|
|
permittedIpv4Addresses = mkOption {
|
|
type = with types; listOf str;
|
|
default = [];
|
|
description = ''
|
|
List of permitted IPv4 addresses that the linter will allow.
|
|
'';
|
|
};
|
|
};
|
|
|
|
config.hooks.ip-search = mkIf cfg.enable {
|
|
name = "IP search";
|
|
entry = let
|
|
permittedIpv4File = pipe cfg.permittedIpv4Addresses [
|
|
(concatStringsSep "\n")
|
|
(pkgs.writeText "allowed_ipv4.txt")
|
|
];
|
|
in "${getExe cfg.package} ${permittedIpv4File} .";
|
|
|
|
pass_filenames = false;
|
|
files = "";
|
|
|
|
package = inputs.self.packages.${pkgs.stdenv.system}.ip-search;
|
|
};
|
|
}
|