https://github.com/mayniklas/nixos-adblock-unbound
Adblocking lists for Unbound DNS servers running on NixOS
https://github.com/mayniklas/nixos-adblock-unbound
Last synced: 10 months ago
JSON representation
Adblocking lists for Unbound DNS servers running on NixOS
- Host: GitHub
- URL: https://github.com/mayniklas/nixos-adblock-unbound
- Owner: MayNiklas
- Created: 2022-06-13T14:00:15.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-01-09T20:35:54.000Z (over 2 years ago)
- Last Synced: 2024-01-10T14:14:09.080Z (over 2 years ago)
- Language: Nix
- Homepage:
- Size: 19.5 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NixOS Unbound Configs
Used to generate unbound configs via Nix functions.
### Nix / NixOS
This repository contains a `flake.nix` file.
```sh
# build the package
nix build .#
```
## How to use
### NixOS
1. Add this repository to your `flake.nix`:
```nix
{
inputs = {
# Adblocking lists for Unbound DNS servers running on NixOS
# https://github.com/MayNiklas/nixos-adblock-unbound
adblock-unbound = {
url = "github:MayNiklas/nixos-adblock-unbound";
inputs = {
adblockStevenBlack.follows = "adblockStevenBlack";
};
};
# Adblocking lists for DNS servers
# input here, so it will get updated by nix flake update
adblockStevenBlack = {
url = "github:StevenBlack/hosts";
flake = false;
};
};
}
```
2. Use the config file with your unbound server:
```nix
{ config, lib, pkgs, adblock-unbound, ... }:
with lib;
let adlist = adblock-unbound.packages.${pkgs.system}; in
{
config = {
services.unbound = {
enable = true;
settings = {
server = {
include = [
"\"${adlist.unbound-adblockStevenBlack}\""
];
interface = [ "127.0.0.1" ];
access-control = [ "127.0.0.0/8 allow" ];
};
forward-zone = [
{
name = ".";
forward-addr = [
"1.1.1.1@853#cloudflare-dns.com"
"1.0.0.1@853#cloudflare-dns.com"
];
forward-tls-upstream = "yes";
}
];
};
};
};
}
```