From 0bd364f096d4af7516b93796629aee815a6259e0 Mon Sep 17 00:00:00 2001 From: sheepfleece Date: Mon, 11 May 2020 04:21:17 +0300 Subject: [PATCH 1/2] Add Usage for NixOS --- readme_template.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/readme_template.md b/readme_template.md index ec37d3728..0a7490cb9 100644 --- a/readme_template.md +++ b/readme_template.md @@ -152,6 +152,20 @@ in hosts format to the generated hosts file. `--whitelist `, or `-w `: Use the given whitelist file to remove hosts from the generated hosts file. +#### Using NixOS: + +To install hosts file on your machine add the following into your `configuration.nix`: + +```haskell + networking.extraHosts = let + hostsPath = https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn-social/hosts; + hostsFile = builtins.fetchurl hostsPath; + in builtins.readFile "${hostsFile}"; +``` + +* NOTE: The call to `fetchurl` is impure. +Use `fetchFromGitHub` with the exact commit if you want to always get the same result. + ## How do I control which sources are unified? From 990766f5bacad796eb185ee9f393dbdeccc94843 Mon Sep 17 00:00:00 2001 From: sheepfleece Date: Tue, 12 May 2020 08:08:05 +0300 Subject: [PATCH 2/2] Use default hosts file --- readme_template.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme_template.md b/readme_template.md index 0a7490cb9..00f12807f 100644 --- a/readme_template.md +++ b/readme_template.md @@ -155,14 +155,14 @@ to remove hosts from the generated hosts file. #### Using NixOS: To install hosts file on your machine add the following into your `configuration.nix`: - ```haskell networking.extraHosts = let - hostsPath = https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn-social/hosts; + hostsPath = https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts; hostsFile = builtins.fetchurl hostsPath; in builtins.readFile "${hostsFile}"; ``` +* NOTE: Change `hostsPath` if you need other versions of hosts file. * NOTE: The call to `fetchurl` is impure. Use `fetchFromGitHub` with the exact commit if you want to always get the same result.