nixpkgs/nixos/modules/config/stevenblack.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

50 lines
853 B
Nix
Raw Normal View History

{
config,
lib,
pkgs,
...
}:
2023-01-05 21:37:23 +00:00
let
inherit (lib)
getOutput
maintainers
mkEnableOption
mkIf
mkOption
mkPackageOption
types
;
2023-01-05 21:37:23 +00:00
cfg = config.networking.stevenblack;
2023-01-05 21:37:23 +00:00
in
{
options.networking.stevenblack = {
enable = mkEnableOption "the stevenblack hosts file blocklist";
2023-01-05 21:37:23 +00:00
package = mkPackageOption pkgs "stevenblack-blocklist" { };
2023-01-05 21:37:23 +00:00
block = mkOption {
type = types.listOf (
types.enum [
"fakenews"
"gambling"
"porn"
"social"
]
);
2023-01-05 21:37:23 +00:00
default = [ ];
description = "Additional blocklist extensions.";
};
};
config = mkIf cfg.enable {
networking.hostFiles = map (x: "${getOutput x cfg.package}/hosts") ([ "ads" ] ++ cfg.block);
2023-01-05 21:37:23 +00:00
};
meta.maintainers = with maintainers; [
moni
artturin
frontear
];
2023-01-05 21:37:23 +00:00
}