Merge pull request #2604 from wkennington/master.notbit

notbit: Bump version and add more configuration options
This commit is contained in:
Austin Seipp 2014-05-17 16:44:27 -05:00
commit a0c6f07be4
2 changed files with 44 additions and 7 deletions

View File

@ -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;
@ -35,7 +40,7 @@ with lib;
port = mkOption {
type = types.uniq types.int;
default = 8443;
default = 8444;
description = "The port which the daemon listens for other bitmessage clients";
};
@ -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";
};
};
};
@ -53,7 +90,7 @@ with lib;
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.notbit sendmail ];
environment.systemPackages = [ sendmail ];
systemd.services.notbit = {
description = "Notbit daemon";
@ -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";

View File

@ -1,12 +1,12 @@
{ stdenv, fetchgit, autoconf, automake, pkgconfig, openssl }:
stdenv.mkDerivation rec {
name = "notbit-0.2-28-g06f9160";
name = "notbit-git-faf0930";
src = fetchgit {
url = "git://git.busydoingnothing.co.uk/notbit";
rev = "06f916081836de12f8e57a9f50c95d4d1b51627f";
sha256 = "d5c38eea1d9ca213bfbea5c88350478a5088b5532e939de9680d72e60aa65288";
url = "git://github.com/bpeel/notbit";
rev = "faf09304bf723e75f3d98cca93cf45236ee9d6b6";
sha256 = "b229f87c4c5e901bfd8b13dffe31157126d98ed02118fff6553e8b58eb9ed030";
};
buildInputs = [ autoconf automake pkgconfig openssl ];