1
0
Fork 0

add dns server

This commit is contained in:
Garionion 2022-07-14 21:04:08 +02:00
parent a7087402f0
commit 37c2affac9
4 changed files with 76 additions and 1 deletions

View File

@ -26,6 +26,10 @@
deployment.targetUser = null;
};
dns = { config, pkgs, ... }: {
deployment.targetHost = "dns.bula22.de";
};
monitoring = { config, pkgs, ... }: {
deployment.targetHost = "monitoring.bula22.de";
};
@ -40,7 +44,7 @@
};
pre-router = { config, pkgs, ... }: {
deployment.targetHost = "lightbuffet.entr0py.cloud";
deployment.targetHost = "lightbuffet.bula22.de";
deployment.keys = {
};

View File

@ -0,0 +1,31 @@
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./dns.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "dns-1"; # Define your hostname.
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking.useDHCP = false;
#networking.interfaces.ens18.useDHCP = false;
#networking.interfaces.ens19.useDHCP = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "21.11"; # Did you read the comment?
}

40
hosts/dns/dns.nix Normal file
View File

@ -0,0 +1,40 @@
{ config, pkgs, lib, ...}:
{
networking.firewall.interfaces.ens19.allowedUDPPorts = [ 53 ];
services.coredns = {
enable = true;
config = ''
.:53 {
log
cache
unbound
}
'';
package = lib.fix (self: (pkgs.buildGoModule {
inherit (pkgs.coredns) pname version src postPatch;
patches = pkgs.coredns.patches or [ ] ++ [
./coredns-unbound.patch
];
buildInputs = [ pkgs.unbound ];
vendorSha256 = "sha256-48S1oT+5uT6d+AM8u93AOTbJkW3CLtaowGv+th3cfyM=";
preBuild = ''
go generate
postInstall () {
cp go.mod $out
}
'';
}).overrideAttrs(old: {
preBuild = ''
cp ${self.passthru.go-modules}/go.mod .
go generate
'';
}));
};
}

View File