mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-15 14:26:33 +01:00
49 lines
853 B
Nix
49 lines
853 B
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
inherit (lib)
|
|
getOutput
|
|
maintainers
|
|
mkEnableOption
|
|
mkIf
|
|
mkOption
|
|
mkPackageOption
|
|
types
|
|
;
|
|
|
|
cfg = config.networking.stevenblack;
|
|
in
|
|
{
|
|
options.networking.stevenblack = {
|
|
enable = mkEnableOption "the stevenblack hosts file blocklist";
|
|
|
|
package = mkPackageOption pkgs "stevenblack-blocklist" { };
|
|
|
|
block = mkOption {
|
|
type = types.listOf (
|
|
types.enum [
|
|
"fakenews"
|
|
"gambling"
|
|
"porn"
|
|
"social"
|
|
]
|
|
);
|
|
default = [ ];
|
|
description = "Additional blocklist extensions.";
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
networking.hostFiles = map (x: "${getOutput x cfg.package}/hosts") ([ "ads" ] ++ cfg.block);
|
|
};
|
|
|
|
meta.maintainers = with maintainers; [
|
|
moni
|
|
artturin
|
|
frontear
|
|
];
|
|
}
|