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; sopsFile = ../../secrets/pihole.yaml;
}; };
networking.nameservers = [ piholeDNSIPBind ];
systemd.services.create-kavita-network = {
systemd.services."create-${name}-network" = {
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
RemainAfterExit = true; 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}''; 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" = { environment.etc."pihole/custom.list" = {
# Copy file instead of symlink # Copy file instead of symlink
mode = "0400"; mode = "0444";
# Creates a pihole custom.list file with the following pattern: # 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; inherit image;
environment = { environment = {
TZ = "Asia/Jakarta"; TZ = "Asia/Jakarta";

View file

@ -1,12 +1,12 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.profile.services.stubby; cfg = config.profile.services.stubby;
inherit (lib) mkIf; inherit (lib) mkIf lists;
in in
{ {
config = mkIf cfg.enable { config = mkIf cfg.enable {
networking.resolvconf.useLocalResolver = false; 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 = { services.stubby = {
enable = true; enable = true;
settings = pkgs.stubby.passthru.settingsExample // { settings = pkgs.stubby.passthru.settingsExample // {