If I’m customizing my hosts blocklist like so:
networking.hostFiles = [
# StevenBlack's Fakenews, Gambling, and Porn blocklist
(
pkgs.fetchFromGitHub {
owner = "StevenBlack";
repo = "hosts";
rev = "master";
hash = "sha256-hcvOs96apLZFVv1Fn9FUxS3VQQeP7h/IC2E3xOqcrZY=";
}
+ "/alternates/fakenews-gambling-porn/hosts"
)
# Blocklist Project's Malware blocklist
(pkgs.fetchurl {
url = "https://blocklistproject.github.io/Lists/malware.txt";
hash = "sha256-HWNBa8k34NLDetBgQGaxrnp5VhC9EnZStFr/4ndceC4=";
})
# etc.
];
how might I define a whitelist?
I’m open to alternative (advanced, custom) solutions.
Is there some kind of way to find and delete lines of a file based on regex, (after maybe concatenating the blocklists into one file)?
Are these types of file operations available in Nix/Nixpkgs, or would I have to configure it to call shell commands?
I’m relatively new to Nix and NixOS, so any help is appreciated!
EDIT: Shrunk the code snippet to improve brevity/readability.
Also, just a smaller thing, is there an option in fetchurl
or similar to not require checking against the hash? With many frequently updated blocklists, it is a bit of a nuisance to have to go and manually update all the hashes whenever I update.