mirror of
https://github.com/librephoenix/nixos-config
synced 2025-10-18 09:34:00 +05:30
Create allowedHosts to let specific hosts through blocklist
This commit is contained in:
parent
0ca063ddde
commit
147aec1692
1 changed files with 7 additions and 1 deletions
|
@ -1,12 +1,18 @@
|
|||
{ config, lib, inputs, ... }:
|
||||
|
||||
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;
|
||||
in {
|
||||
options = {
|
||||
systemSettings.security.blocklist = {
|
||||
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;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue