mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-12-02 04:56:14 +01:00
44 lines
834 B
Nix
44 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;
|
||
|
};
|
||
|
}
|