feat: adguard home basic setup

This commit is contained in:
Gustavo "Guz" L. de Mello
2024-01-27 12:03:36 -03:00
parent cba902c988
commit 2715bf7bf5
3 changed files with 57 additions and 0 deletions

View File

@@ -19,6 +19,13 @@
enable = true;
flakeDir = "/home/guz/.nix#homex";
adguard = {
enable = true;
settings.server = {
port = 3010;
};
};
forgejo = {
enable = true;
settings.users."user1" = {
@@ -27,6 +34,9 @@
password = /. + config.sops.secrets."forgejo/user1/password".path;
admin = true;
};
settings.server = {
port = 3020;
};
};
};

View File

@@ -0,0 +1,46 @@
{ config, lib, pkgs, ... }:
let
cfg = config.homelab.adguard;
in
{
imports = [ ];
options.homelab.adguard = with lib; with lib.types; {
enable = mkEnableOption "";
extraArgs = mkOption {
type = listOf str;
default = [ ];
};
settings = {
server.domain = mkOption {
type = str;
default = "localhost";
};
server.port = mkOption {
type = port;
default = 3000;
};
server.address = mkOption {
type = str;
default = "0.0.0.0";
};
};
};
config = lib.mkIf cfg.enable {
networking.firewall = {
allowedTCPPorts = [ 53 ];
allowedUDPPorts = [ 53 51820 ];
};
services.adguardhome = {
enable = true;
settings = {
bind_port = cfg.settings.server.port;
bind_host = cfg.settings.server.address;
http = {
address = "${cfg.settings.server.address}:${toString cfg.settings.server.port}";
};
};
};
};
}

View File

@@ -24,6 +24,7 @@ in
{
imports = [
./forgejo.nix
./adguard.nix
];
options.homelab = with lib; with lib.types; {
enable = mkEnableOption "";