diff options
author | William A. Kennington III <william@wkennington.com> | 2014-05-13 20:20:19 -0500 |
---|---|---|
committer | William A. Kennington III <william@wkennington.com> | 2014-05-13 20:20:19 -0500 |
commit | 08467c14deffcf33e0a1861c2dd50f7ebfd98852 (patch) | |
tree | a1b6cd77bf80c63efd7ad437c606432365d7beda /nixos/modules/services | |
parent | 042273e528b5e5837984f56f435053b8c5382770 (diff) | |
download | nixlib-08467c14deffcf33e0a1861c2dd50f7ebfd98852.tar nixlib-08467c14deffcf33e0a1861c2dd50f7ebfd98852.tar.gz nixlib-08467c14deffcf33e0a1861c2dd50f7ebfd98852.tar.bz2 nixlib-08467c14deffcf33e0a1861c2dd50f7ebfd98852.tar.lz nixlib-08467c14deffcf33e0a1861c2dd50f7ebfd98852.tar.xz nixlib-08467c14deffcf33e0a1861c2dd50f7ebfd98852.tar.zst nixlib-08467c14deffcf33e0a1861c2dd50f7ebfd98852.zip |
notbit: Add additional options to the daemon
Diffstat (limited to 'nixos/modules/services')
-rw-r--r-- | nixos/modules/services/networking/notbit.nix | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/nixos/modules/services/networking/notbit.nix b/nixos/modules/services/networking/notbit.nix index b6a2b7897caa..3e8c956f191e 100644 --- a/nixos/modules/services/networking/notbit.nix +++ b/nixos/modules/services/networking/notbit.nix @@ -1,5 +1,6 @@ { config, lib, pkgs, ... }: +with pkgs.lib; let cfg = config.services.notbit; varDir = "/var/lib/notbit"; @@ -14,6 +15,10 @@ let --set XDG_RUNTIME_DIR ${varDir} ''; }; + opts = "${optionalString cfg.allowPrivateAddresses "-L"} ${optionalString cfg.noBootstrap "-b"} ${optionalString cfg.specifiedPeersOnly "-e"}"; + peers = concatStringsSep " " (map (str: "-P \"${str}\"") cfg.peers); + listen = if cfg.listenAddress == [] then "-p ${toString cfg.port}" else + concatStringsSep " " (map (addr: "-a \"${addr}:${toString cfg.port}\"") cfg.listenAddress); in with lib; @@ -45,6 +50,38 @@ with lib; description = "Set the nice level for the notbit daemon"; }; + listenAddress = mkOption { + type = types.listOf types.str; + default = [ ]; + example = [ "localhost" "myhostname" ]; + description = "The addresses which notbit will use to listen for incoming connections. These addresses are advertised to connecting clients."; + }; + + peers = mkOption { + type = types.listOf types.str; + default = [ ]; + example = [ "bitmessage.org:8877" ]; + description = "The initial set of peers notbit will connect to."; + }; + + specifiedPeersOnly = mkOption { + type = types.uniq types.bool; + default = false; + description = "If true, notbit will only connect to peers specified by the peers option."; + }; + + allowPrivateAddresses = mkOption { + type = types.uniq types.bool; + default = false; + description = "If true, notbit will allow connections to to RFC 1918 addresses."; + }; + + noBootstrap = mkOption { + type = types.uniq types.bool; + default = false; + description = "If true, notbit will not bootstrap an initial peerlist from bitmessage.org servers"; + }; + }; }; @@ -70,7 +107,7 @@ with lib; serviceConfig = { Type = "forking"; - ExecStart = "${pkgs.notbit}/bin/notbit -d -p ${toString cfg.port}"; + ExecStart = "${pkgs.notbit}/bin/notbit -d ${listen} ${peers} ${opts}"; User = "notbit"; Group = "notbit"; UMask = "0077"; |