1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7let
8 inherit (lib)
9 getOutput
10 maintainers
11 mkEnableOption
12 mkIf
13 mkOption
14 mkPackageOption
15 types
16 ;
17
18 cfg = config.networking.stevenblack;
19in
20{
21 options.networking.stevenblack = {
22 enable = mkEnableOption "the stevenblack hosts file blocklist";
23
24 package = mkPackageOption pkgs "stevenblack-blocklist" { };
25
26 block = mkOption {
27 type = types.listOf (
28 types.enum [
29 "fakenews"
30 "gambling"
31 "porn"
32 "social"
33 ]
34 );
35 default = [ ];
36 description = "Additional blocklist extensions.";
37 };
38 };
39
40 config = mkIf cfg.enable {
41 networking.hostFiles = map (x: "${getOutput x cfg.package}/hosts") ([ "ads" ] ++ cfg.block);
42 };
43
44 meta.maintainers = with maintainers; [
45 moni
46 artturin
47 frontear
48 ];
49}