Create allowedHosts to let specific hosts through blocklist
This commit is contained in:
@@ -1,12 +1,18 @@
|
|||||||
{ config, lib, inputs, ... }:
|
{ config, lib, inputs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
blocklist = builtins.readFile "${inputs.blocklist-hosts}/alternates/gambling-porn/hosts";
|
allowedHosts = config.systemSettings.security.blocklist.allowedHosts;
|
||||||
|
hostsFileDeletions = builtins.genList (x: "0.0.0.0 " + (builtins.elemAt allowedHosts x)) (builtins.length allowedHosts);
|
||||||
|
blocklist = builtins.replaceStrings hostsFileDeletions (builtins.genList (x: "") (builtins.length hostsFileDeletions)) (builtins.readFile "${inputs.blocklist-hosts}/alternates/gambling-porn/hosts");
|
||||||
cfg = config.systemSettings.security.blocklist;
|
cfg = config.systemSettings.security.blocklist;
|
||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
systemSettings.security.blocklist = {
|
systemSettings.security.blocklist = {
|
||||||
enable = lib.mkEnableOption "Enable basic host blocking for bad websites";
|
enable = lib.mkEnableOption "Enable basic host blocking for bad websites";
|
||||||
|
allowedHosts = lib.mkOption {
|
||||||
|
description = "List of hosts to allow (remove from blocklist)";
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user