From 28bacc0925ad9e2181f2d09339d211ac35fe7972 Mon Sep 17 00:00:00 2001 From: s-prechtl Date: Mon, 31 Mar 2025 18:48:05 +0200 Subject: [PATCH] feat: pi hole on saberofxebec --- hosts/saberofxebec/configuration.nix | 34 ++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/hosts/saberofxebec/configuration.nix b/hosts/saberofxebec/configuration.nix index ef4d01b..992e15e 100644 --- a/hosts/saberofxebec/configuration.nix +++ b/hosts/saberofxebec/configuration.nix @@ -6,7 +6,9 @@ lib, pkgs, ... -}: { +}:let + serverIP = "192.168.0.2"; +in{ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix @@ -39,9 +41,10 @@ # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ - vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + vim wget git + btop ]; services.openssh = { @@ -60,5 +63,32 @@ nix.settings.experimental-features = ["nix-command" "flakes"]; + virtualisation.docker.enable = true; + virtualisation.oci-containers = { + backend = "docker"; + containers.pihole = { + image = "pihole/pihole:latest"; + ports = [ + "${serverIP}:53:53/tcp" + "${serverIP}:53:53/udp" + "80:80" + "443: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"; # Did you read the comment? }