### Nix Flake
-NixOS installations which are managed through _flakes_ can use the hosts file
-like this:
+NixOS installations which are managed through _flakes_ can directly use the `flake.nix` in this repository as an input.
+
+It contains a `nixosModule` that can be used to install the `hosts` file locally, as well as a package containing config files for the [Unbound](https://github.com/NLnetLabs/unbound) DNS server to be used as blocklists.
+
```nix
{
nixosConfigurations.my-hostname = {
system = "<architecture>";
modules = [
- hosts.nixosModule {
+ # nixosModule to install hosts file locally:
+ hosts.nixosModule
+ {
networking.stevenBlackHosts = {
enable = true;
# optionally:
# blockSocial = true;
};
}
+
+ # configure unbound to use config as blocklist:
+ {
+ {
+ services.unbound = {
+ enable = true;
+ settings.server.include = [
+ "${hosts.packages.${system}.unbound}/hosts"
+ # alternates are also available, e.g. /fakenews, /fakenews-gambling etc.
+ ];
+ };
+ }
+ }
];
};
};