nixos/samba-wsdd: add openFirewall option

Changed files
+14 -11
nixos
modules
services
network-filesystems
tests
+12 -7
nixos/modules/services/network-filesystems/samba-wsdd.nix
···
enable = mkEnableOption (lib.mdDoc ''
Web Services Dynamic Discovery host daemon. This enables (Samba) hosts, like your local NAS device,
to be found by Web Service Discovery Clients like Windows.
-
-
::: {.note}
-
If you use the firewall consider adding the following:
-
-
networking.firewall.allowedTCPPorts = [ 5357 ];
-
networking.firewall.allowedUDPPorts = [ 3702 ];
-
:::
'');
interface = mkOption {
type = types.nullOr types.str;
···
default = null;
example = 2;
description = lib.mdDoc "Hop limit for multicast packets (default = 1).";
};
workgroup = mkOption {
type = types.nullOr types.str;
···
SystemCallArchitectures = "native";
SystemCallFilter = "~@cpu-emulation @debug @mount @obsolete @privileged @resources";
};
};
};
}
···
enable = mkEnableOption (lib.mdDoc ''
Web Services Dynamic Discovery host daemon. This enables (Samba) hosts, like your local NAS device,
to be found by Web Service Discovery Clients like Windows.
'');
interface = mkOption {
type = types.nullOr types.str;
···
default = null;
example = 2;
description = lib.mdDoc "Hop limit for multicast packets (default = 1).";
+
};
+
openFirewall = mkOption {
+
description = lib.mdDoc ''
+
Whether to open the required firewall ports in the firewall.
+
'';
+
default = false;
+
type = lib.types.bool;
};
workgroup = mkOption {
type = types.nullOr types.str;
···
SystemCallArchitectures = "native";
SystemCallFilter = "~@cpu-emulation @debug @mount @obsolete @privileged @resources";
};
+
};
+
+
networking.firewall = mkIf cfg.openFirewall {
+
allowedTCPPorts = [ 5357 ];
+
allowedUDPPorts = [ 3702 ];
};
};
}
+2 -4
nixos/tests/samba-wsdd.nix
···
client_wsdd = { pkgs, ... }: {
services.samba-wsdd = {
enable = true;
interface = "eth1";
workgroup = "WORKGROUP";
hostname = "CLIENT-WSDD";
discovery = true;
extraOptions = [ "--no-host" ];
};
-
networking.firewall.allowedTCPPorts = [ 5357 ];
-
networking.firewall.allowedUDPPorts = [ 3702 ];
};
server_wsdd = { ... }: {
services.samba-wsdd = {
enable = true;
interface = "eth1";
workgroup = "WORKGROUP";
hostname = "SERVER-WSDD";
};
-
networking.firewall.allowedTCPPorts = [ 5357 ];
-
networking.firewall.allowedUDPPorts = [ 3702 ];
};
};
···
client_wsdd = { pkgs, ... }: {
services.samba-wsdd = {
enable = true;
+
openFirewall = true;
interface = "eth1";
workgroup = "WORKGROUP";
hostname = "CLIENT-WSDD";
discovery = true;
extraOptions = [ "--no-host" ];
};
};
server_wsdd = { ... }: {
services.samba-wsdd = {
enable = true;
+
openFirewall = true;
interface = "eth1";
workgroup = "WORKGROUP";
hostname = "SERVER-WSDD";
};
};
};