2024-07-27 06:49:29 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
2023-01-11 07:51:40 +00:00
|
|
|
let
|
2024-07-27 06:49:29 +00:00
|
|
|
inherit (lib)
|
|
|
|
getOutput
|
|
|
|
maintainers
|
|
|
|
mkEnableOption
|
|
|
|
mkIf
|
|
|
|
mkOption
|
|
|
|
mkPackageOption
|
|
|
|
types
|
|
|
|
;
|
2023-01-11 07:51:40 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
cfg = config.networking.stevenblack;
|
2023-01-11 07:51:40 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
options.networking.stevenblack = {
|
2024-04-21 15:54:59 +00:00
|
|
|
enable = mkEnableOption "the stevenblack hosts file blocklist";
|
2023-01-11 07:51:40 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
package = mkPackageOption pkgs "stevenblack-blocklist" { };
|
|
|
|
|
2023-01-11 07:51:40 +00:00
|
|
|
block = mkOption {
|
2024-07-27 06:49:29 +00:00
|
|
|
type = types.listOf (
|
|
|
|
types.enum [
|
|
|
|
"fakenews"
|
|
|
|
"gambling"
|
|
|
|
"porn"
|
|
|
|
"social"
|
|
|
|
]
|
|
|
|
);
|
2023-01-11 07:51:40 +00:00
|
|
|
default = [ ];
|
2024-04-21 15:54:59 +00:00
|
|
|
description = "Additional blocklist extensions.";
|
2023-01-11 07:51:40 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2024-07-27 06:49:29 +00:00
|
|
|
networking.hostFiles = map (x: "${getOutput x cfg.package}/hosts") ([ "ads" ] ++ cfg.block);
|
2023-01-11 07:51:40 +00:00
|
|
|
};
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
meta.maintainers = with maintainers; [
|
|
|
|
moni
|
|
|
|
artturin
|
|
|
|
frontear
|
|
|
|
];
|
2023-01-11 07:51:40 +00:00
|
|
|
}
|