mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-22 14:45:27 +00:00
nixos/spacecookie: add openFirewall option
Convenience shortcut which automatically configures the firewall to open the port which is also configured for the spacecookie service.
This commit is contained in:
parent
58be28d7ce
commit
d1f57cbaf0
|
@ -37,12 +37,19 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
openFirewall = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to open the necessary port in the firewall for spacecookie.
|
||||
'';
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = 70;
|
||||
description = ''
|
||||
Port the gopher service should be exposed on. The
|
||||
firewall is not opened automatically.
|
||||
Port the gopher service should be exposed on.
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -100,5 +107,9 @@ in {
|
|||
RestrictAddressFamilies = "AF_UNIX AF_INET6";
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall = mkIf cfg.openFirewall {
|
||||
allowedTCPPorts = [ cfg.port ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ in
|
|||
name = "spacecookie";
|
||||
nodes = {
|
||||
${gopherHost} = {
|
||||
networking.firewall.allowedTCPPorts = [ 70 ];
|
||||
systemd.services.spacecookie = {
|
||||
preStart = ''
|
||||
mkdir -p ${gopherRoot}/directory
|
||||
|
@ -21,6 +20,7 @@ in
|
|||
enable = true;
|
||||
root = gopherRoot;
|
||||
hostname = gopherHost;
|
||||
openFirewall = true;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue