From b74821f31b468d8a302b07e528bcce16c24e4b06 Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Wed, 10 Mar 2021 22:07:27 +0100 Subject: [PATCH] nixos/spacecookie: add address option customizing listen address This configuration option reflects a new feature from the unreleased spacecookie version allowing to customize the address spacecookie will listen on (e. g. "::1" to bind on link-local addresses only). We will not use this feature in the future, since the configuration option of spacecookie naturally only has an effect if we don't use socket activation (and spacecookie sets up its own socket), but having the same functionality in the service seems like a good idea. We can luckily emulate this behavior with socket activation as well. --- nixos/modules/services/networking/spacecookie.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/networking/spacecookie.nix b/nixos/modules/services/networking/spacecookie.nix index adba0fbfbf2..4b908eee054 100644 --- a/nixos/modules/services/networking/spacecookie.nix +++ b/nixos/modules/services/networking/spacecookie.nix @@ -60,6 +60,16 @@ in { The root directory spacecookie serves via gopher. ''; }; + + address = mkOption { + type = types.str; + default = "[::]"; + description = '' + Address to listen on. Must be in the + ListenStream= syntax of + systemd.socket(5). + ''; + }; }; }; @@ -68,7 +78,7 @@ in { systemd.sockets.spacecookie = { description = "Socket for the Spacecookie Gopher Server"; wantedBy = [ "sockets.target" ]; - listenStreams = [ "[::]:${toString cfg.port}" ]; + listenStreams = [ "${cfg.address}:${toString cfg.port}" ]; socketConfig = { BindIPv6Only = "both"; };