mirror of
https://github.com/donovanglover/nix-config.git
synced 2025-01-09 15:38:12 +01:00
meta: Add options for networking module
Now it's possible to use the system without mullvad vpn.
This commit is contained in:
parent
ecb2463ee7
commit
3da9c62869
@ -57,11 +57,17 @@
|
||||
home-manager.sharedModules = builtins.attrValues self.homeManagerModules;
|
||||
environment.systemPackages = builtins.attrValues self.packages.x86_64-linux;
|
||||
|
||||
modules.hardware = {
|
||||
modules = {
|
||||
hardware = {
|
||||
disableLaptopKeyboard = true;
|
||||
lidIgnore = true;
|
||||
powerIgnore = true;
|
||||
};
|
||||
|
||||
networking = {
|
||||
mullvad = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
|
@ -1,6 +1,27 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkEnableOption mkOption mkIf;
|
||||
inherit (lib.types) string;
|
||||
|
||||
cfg = config.modules.networking;
|
||||
in
|
||||
{
|
||||
options.modules.networking = {
|
||||
mullvad = mkEnableOption "mullvad vpn";
|
||||
|
||||
hostName = mkOption {
|
||||
type = string;
|
||||
default = "nixos";
|
||||
};
|
||||
|
||||
allowSRB2Port = mkEnableOption "port for srb2";
|
||||
allowZolaPort = mkEnableOption "port for zola";
|
||||
};
|
||||
|
||||
config = with cfg; {
|
||||
networking = {
|
||||
hostName = "nixos";
|
||||
inherit hostName;
|
||||
|
||||
networkmanager = {
|
||||
enable = true;
|
||||
@ -12,20 +33,20 @@
|
||||
|
||||
useHostResolvConf = true;
|
||||
|
||||
resolvconf.enable = false;
|
||||
resolvconf.enable = mkIf mullvad false;
|
||||
|
||||
nat = {
|
||||
nat = mkIf mullvad {
|
||||
enable = true;
|
||||
internalInterfaces = [ "ve-+" ];
|
||||
externalInterface = "wg-mullvad";
|
||||
};
|
||||
|
||||
firewall = {
|
||||
allowedUDPPorts = [
|
||||
allowedUDPPorts = mkIf allowSRB2Port [
|
||||
5029
|
||||
];
|
||||
|
||||
allowedTCPPorts = [
|
||||
allowedTCPPorts = mkIf allowZolaPort [
|
||||
1111
|
||||
];
|
||||
};
|
||||
@ -33,8 +54,9 @@
|
||||
|
||||
services.resolved.llmnr = "false";
|
||||
|
||||
services.mullvad-vpn = {
|
||||
services.mullvad-vpn = mkIf mullvad {
|
||||
enable = true;
|
||||
enableExcludeWrapper = false;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user