From 168b38b49ddfdd9b1f74601b06e0dbf28f055d38 Mon Sep 17 00:00:00 2001 From: s-prechtl Date: Mon, 31 Mar 2025 14:15:59 +0200 Subject: [PATCH] feat: docker for pi hole --- hosts/karasumaru/configuration.nix | 31 +++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/hosts/karasumaru/configuration.nix b/hosts/karasumaru/configuration.nix index 1ba69ca..71c482f 100644 --- a/hosts/karasumaru/configuration.nix +++ b/hosts/karasumaru/configuration.nix @@ -6,7 +6,9 @@ lib, pkgs, ... -}: { +}: let + serverIP = 0.0 .0 .0; +in { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix @@ -35,5 +37,32 @@ }; }; + virtualisation.docker.enable = true; + virtualisation.oci-containers = { + backend = "docker"; + virtualisation.oci-containers.containers.pihole = { + image = "pihole/pihole:latest"; + ports = [ + "${serverIP}:53:53/tcp" + "${serverIP}:53:53/udp" + "3080:80" + "30443:443" + ]; + volumes = [ + "/var/lib/pihole/:/etc/pihole/" + "/var/lib/dnsmasq.d:/etc/dnsmasq.d/" + ]; + environment = { + ServerIP = serverIP; + }; + extraOptions = [ + "--cap-add=NET_ADMIN" + "--dns=127.0.0.1" + "--dns=1.1.1.1" + ]; + workdir = "/var/lib/pihole/"; + }; + }; + system.stateVersion = "24.11"; }