2024-04-24 13:49:20 +01:00
|
|
|
# Edit this configuration file to define what should be installed on
|
|
|
|
# your system. Help is available in the configuration.nix(5) man page, on
|
|
|
|
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
|
|
|
{
|
2024-04-24 13:55:10 +01:00
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: {
|
|
|
|
imports = [
|
|
|
|
# Include the results of the hardware scan.
|
|
|
|
./hardware-configuration.nix
|
|
|
|
];
|
2024-04-24 13:49:20 +01:00
|
|
|
|
|
|
|
age.secrets.dnsmasq-nextdns-profile = {
|
|
|
|
file = ../../secrets/dnsmasq-nextdns-profile.age;
|
|
|
|
owner = "dnsmasq";
|
|
|
|
};
|
|
|
|
|
|
|
|
nix = {
|
|
|
|
settings = {
|
|
|
|
auto-optimise-store = true;
|
|
|
|
experimental-features = ["nix-command" "flakes"];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
# Use the systemd-boot EFI boot loader.
|
|
|
|
boot.loader.systemd-boot.enable = true;
|
|
|
|
boot.loader.efi.canTouchEfiVariables = true;
|
|
|
|
|
|
|
|
networking = {
|
|
|
|
hostName = "dnsmasq-cache"; # Define your hostname.
|
|
|
|
useDHCP = false;
|
|
|
|
|
2024-04-24 13:55:10 +01:00
|
|
|
interfaces.enp6s18.ipv4.addresses = [
|
|
|
|
{
|
|
|
|
address = "192.168.50.87";
|
|
|
|
prefixLength = 24;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
nameservers = ["1.1.1.1" "1.0.0.1"];
|
2024-04-24 13:49:20 +01:00
|
|
|
firewall = {
|
|
|
|
enable = true;
|
|
|
|
allowedUDPPorts = [53];
|
|
|
|
allowedTCPPorts = [22 53 9153];
|
|
|
|
trustedInterfaces = ["enp6s18" "tailscale0"];
|
|
|
|
checkReversePath = "loose";
|
|
|
|
allowedUDPPortRanges = [
|
|
|
|
{
|
|
|
|
from = 3000;
|
|
|
|
to = 22000;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
defaultGateway = "192.168.50.1";
|
|
|
|
defaultGateway6 = "2a02:1648:6709::1";
|
|
|
|
nftables.enable = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
services = {
|
|
|
|
openssh.enable = true;
|
|
|
|
tailscale.enable = true;
|
|
|
|
dnsmasq = {
|
|
|
|
enable = true;
|
|
|
|
settings = {
|
|
|
|
interface = "tailscale0";
|
|
|
|
cache-size = "4000";
|
|
|
|
no-resolv = true;
|
|
|
|
bogus-priv = true;
|
|
|
|
strict-order = true;
|
2024-04-24 13:55:10 +01:00
|
|
|
server = ["2a07:a8c1::" "45.90.30.0" "2a07:a8c0::" "45.90.28.0"];
|
2024-04-24 13:49:20 +01:00
|
|
|
conf-file = "${config.age.secrets.dnsmasq-nextdns-profile.path}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
environment = {
|
|
|
|
systemPackages = with pkgs; [
|
|
|
|
tailscale
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
virtualisation.oci-containers.containers = {
|
|
|
|
dnsmasq_exporter = {
|
|
|
|
image = "git.gmem.ca/arch/dnsmasq_exporter";
|
|
|
|
extraOptions = ["--network=host"];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
system.stateVersion = "23.11"; # Did you read the comment?
|
|
|
|
}
|