add wireguard and adguard

This commit is contained in:
Kopatz
2024-05-04 21:06:24 +02:00
parent 349a6d61aa
commit 311c73c9d8
4 changed files with 29 additions and 12 deletions

View File

@@ -1,24 +1,20 @@
{ config, pkgs, inputs, vars, ... }:
{ config, pkgs, inputs, lib , ... }:
with lib;
let
cfg = config.custom.services.acme;
cfg = config.custom.services.adguard;
in
{
options.custom.services.acme = {
enable = mkEnableOption "Enables acme";
options.custom.services.adguard = {
enable = mkEnableOption "Enables adguard";
ip = lib.mkOption {
type = types.str;
default = config.custom.static-ip.ip;
description = "this servers ipv4 address";
};
wireguardIp = lib.mkOption {
type = types.str;
description = "wireguard ipv4 address";
};
};
config = let
ip = cfg.ip;
wireguardIp = cfg.wireguardIp;
wireguardIp = config.custom.services.wireguard.ip;
in lib.mkIf cfg.enable {
networking.firewall.allowedTCPPorts = [ 53 ];
networking.firewall.allowedUDPPorts = [ 53 ];

View File

@@ -2,9 +2,11 @@
{
imports = [
./acme.nix
./adguard.nix
./kubernetes.nix
./kavita.nix
./nginx.nix
./fileshelter.nix
./wireguard.nix
];
}

View File

@@ -1,8 +1,21 @@
{ config, pkgs, lib, inputs, vars, ... }:
{ config, pkgs, lib, inputs, ... }:
with lib;
let
wireguardIp = vars.wireguardIp;
cfg = config.custom.services.wireguard;
in
{
options.custom.services.wireguard = {
enable = mkEnableOption "Enables wireguard";
ip = lib.mkOption {
default = "192.168.2.1";
type = types.str;
description = "ipv4 address";
};
};
config =
let
wireguardIp = cfg.ip;
in lib.mkIf cfg.enable {
age.secrets.wireguard-private = {
file = ../../secrets/wireguard-private.age;
@@ -94,4 +107,5 @@ in
privateKeyFile = config.age.secrets.wireguard-private.path;
};
};
};
}

View File

@@ -18,7 +18,7 @@
enable = true;
ip = "192.168.0.10";
interface = "enp5s0f0";
dns = "192.168.0.6";
dns = "127.0.0.1";
};
user = {
name = "vm";
@@ -37,6 +37,11 @@
enable = true;
dir = "/data/kavita";
};
wireguard = {
enable = true;
ip = "192.168.2.1";
};
adguard.enable = true;
};
nftables.enable = true;
cli-tools.enable = true;