From a181a11e3efb33215a6e06ffbccd2a46fe577c52 Mon Sep 17 00:00:00 2001 From: osbm Date: Wed, 8 Jan 2025 17:12:01 +0300 Subject: [PATCH] update concentration.nix --- common/concentration.nix | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/common/concentration.nix b/common/concentration.nix index 52cf7c3..8fa9bc4 100644 --- a/common/concentration.nix +++ b/common/concentration.nix @@ -4,11 +4,37 @@ config, ... }: { - networking.extraHosts = '' - 0.0.0.0 youtube.com - ::0 youtube.com + options = { + blockYoutube = lib.mkOption { + type = lib.types.bool; + default = false; + description = "Disables youtube using /etc/hosts file"; + }; + blockTwitter = lib.mkOption { + type = lib.types.bool; + default = false; + description = "Disables twitter using /etc/hosts file"; + }; + }; - 0.0.0.0 www.youtube.com - ::0 www.youtube.com - ''; -} + config = lib.mkMerge [ + (lib.mkIf config.blockYoutube { + networking.extraHosts = '' + 0.0.0.0 youtube.com + ::0 youtube.com + + 0.0.0.0 www.youtube.com + ::0 www.youtube.com + ''; + }) + (lib.mkIf config.blockTwitter { + networking.extraHosts = '' + 0.0.0.0 twitter.com + ::0 twitter.com + + 0.0.0.0 www.twitter.com + ::0 www.twitter.com + ''; + }) + ]; +} \ No newline at end of file