pihole: added to nameserver

This commit is contained in:
Tigor Hutasuhut 2024-06-17 19:54:21 +07:00
parent baccbeb7d0
commit 86f7b971bb
2 changed files with 8 additions and 6 deletions

View file

@ -23,19 +23,21 @@ in
sopsFile = ../../secrets/pihole.yaml;
};
networking.nameservers = [ piholeDNSIPBind ];
systemd.services.create-kavita-network = {
systemd.services."create-${name}-network" = {
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
wantedBy = [ "podman-pihole.service" ];
wantedBy = [ "podman-${name}.service" ];
script = ''${pkgs.podman}/bin/podman network exists ${name} || ${pkgs.podman}/bin/podman network create --gateway=${gateway} --subnet=${subnet} --ip-range=${ip-range} ${name}'';
};
environment.etc."pihole/custom.list" = {
# Copy file instead of symlink
mode = "0400";
mode = "0444";
# Creates a pihole custom.list file with the following pattern:
#
@ -53,7 +55,7 @@ in
)}
'';
};
virtualisation.oci-containers.containers.pihole = {
virtualisation.oci-containers.containers.${name} = {
inherit image;
environment = {
TZ = "Asia/Jakarta";

View file

@ -1,12 +1,12 @@
{ config, lib, pkgs, ... }:
let
cfg = config.profile.services.stubby;
inherit (lib) mkIf;
inherit (lib) mkIf lists;
in
{
config = mkIf cfg.enable {
networking.resolvconf.useLocalResolver = false;
networking.nameservers = [ "192.168.100.5" ];
networking.nameservers = lists.optional (!config.profile.podman.pihole.enable) "192.168.100.5";
services.stubby = {
enable = true;
settings = pkgs.stubby.passthru.settingsExample // {