diff options
author | Matthew Bauer <mjbauer95@gmail.com> | 2020-06-11 17:53:59 -0500 |
---|---|---|
committer | Matthew Bauer <mjbauer95@gmail.com> | 2020-06-12 17:15:34 -0500 |
commit | 2c2f6c0b381ab89c44098d22c1f643c5f90d3415 (patch) | |
tree | 30ca1f609fe3ef21f63276f84c14ab0457c15144 /nixos/modules/services/network-filesystems/ipfs.nix | |
parent | 982a17a48e454df80c5ab84de0e17948462f8970 (diff) |
nixos/ipfs: only set listenstream when gateway/api is default
Diffstat (limited to 'nixos/modules/services/network-filesystems/ipfs.nix')
-rw-r--r-- | nixos/modules/services/network-filesystems/ipfs.nix | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/nixos/modules/services/network-filesystems/ipfs.nix b/nixos/modules/services/network-filesystems/ipfs.nix index a5f514974f264..a3bd40135d193 100644 --- a/nixos/modules/services/network-filesystems/ipfs.nix +++ b/nixos/modules/services/network-filesystems/ipfs.nix @@ -1,7 +1,8 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, options, ... }: with lib; let cfg = config.services.ipfs; + opt = options.services.ipfs; ipfsFlags = toString ([ (optionalString cfg.autoMount "--mount") @@ -247,15 +248,16 @@ in { wantedBy = [ "default.target" ]; }; - # Note the upstream service assumes default host / port - # we should override it when a custom is provided above. systemd.sockets.ipfs-gateway = { wantedBy = [ "sockets.target" ]; + socketConfig.ListenStream = [ "" ] + ++ lib.optional (cfg.gatewayAddress == opt.gatewayAddress.default) [ "127.0.0.1:8080" "[::1]:8080" ]; }; systemd.sockets.ipfs-api = { wantedBy = [ "sockets.target" ]; - socketConfig.ListenStream = [ "%t/ipfs.sock" ]; + socketConfig.ListenStream = [ "" "%t/ipfs.sock" ] + ++ lib.optional (cfg.apiAddress == opt.apiAddress.default) [ "127.0.0.1:5001" "[::1]:5001" ]; }; }; |