Skip to content

Instantly share code, notes, and snippets.

@emmanuelrosa
Created June 29, 2018 23:20
Show Gist options
  • Save emmanuelrosa/7e7cdb5da97b51659707235afd551710 to your computer and use it in GitHub Desktop.
Save emmanuelrosa/7e7cdb5da97b51659707235afd551710 to your computer and use it in GitHub Desktop.
Hosts to block in /etc/hosts
{ stdenv, pkgs, lib }:
let
rawHosts = builtins.fetchurl http://winhelp2002.mvps.org/hosts.txt;
cleanedHosts = stdenv.mkDerivation {
name = "mvps-hosts";
phases = [ "installPhase" ];
installPhase = ''
cat ${rawHosts} | tr -s '\r' '\n' | sed -e '/^#/ d' | cut -d ' ' -f 1,2 | sed -e '/localhost/ d' > $out
'';
};
in
lib.readFile cleanedHosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment