From 06aeb7d87f0acfd2c5c38f7a17348e1c5485a73d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 23 Jan 2010 15:47:33 +0000 Subject: [PATCH] GNUnet: Add options; add as a system package; provide /etc/gnunetd.conf. svn path=/nixos/trunk/; revision=19630 --- modules/services/networking/gnunet.nix | 51 ++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/modules/services/networking/gnunet.nix b/modules/services/networking/gnunet.nix index 53223f1df22..a717ff47f02 100644 --- a/modules/services/networking/gnunet.nix +++ b/modules/services/networking/gnunet.nix @@ -12,21 +12,27 @@ let GNUNETD_HOME = ${home} [GNUNETD] - HOSTLISTURL = ${lib.concatStringsSep " " hostLists} - APPLICATIONS = ${lib.concatStringsSep " " applications} - TRANSPORTS = ${lib.concatStringsSep " " transports} + HOSTLISTURL = ${concatStringsSep " " hostLists} + APPLICATIONS = ${concatStringsSep " " applications} + TRANSPORTS = ${concatStringsSep " " transports} [LOAD] MAXNETDOWNBPSTOTAL = ${toString load.maxNetDownBandwidth} MAXNETUPBPSTOTAL = ${toString load.maxNetUpBandwidth} HARDUPLIMIT = ${toString load.hardNetUpBandwidth} MAXCPULOAD = ${toString load.maxCPULoad} - INTERFACES = ${lib.concatStringsSep " " load.interfaces} + INTERFACES = ${concatStringsSep " " load.interfaces} [FS] QUOTA = ${toString fileSharing.quota} ACTIVEMIGRATION = ${if fileSharing.activeMigration then "YES" else "NO"} + [UDP] + PORT = ${toString udp.port} + + [TCP] + PORT = ${toString tcp.port} + [MODULES] sqstore = sqstore_sqlite dstore = dstore_sqlite @@ -122,6 +128,24 @@ in }; }; + udp = { + port = mkOption { + default = 2086; # assigned by IANA + description = '' + The UDP port for use by GNUnet. + ''; + }; + }; + + tcp = { + port = mkOption { + default = 2086; # assigned by IANA + description = '' + The TCP port for use by GNUnet. + ''; + }; + }; + load = { maxNetDownBandwidth = mkOption { default = 50000; @@ -191,6 +215,17 @@ in home = "/var/empty"; }; + # The user tools that talk to `gnunetd' should come from the same source, + # so install them globally. + environment.systemPackages = [ pkgs.gnunet ]; + + environment.etc = [ + # Tools such as `gnunet-transport-check' expect /etc/gnunetd.conf. + { source = configFile; + target = "gnunetd.conf"; + } + ]; + jobs.gnunetd = { description = "The GNUnet Daemon"; @@ -205,10 +240,10 @@ in exec = '' - ${pkgs.gnunet}/bin/gnunetd \ - ${if debug then "--debug" else "" } \ - --user="gnunetd" \ - --config="${configFile}" \ + ${pkgs.gnunet}/bin/gnunetd \ + ${if cfg.debug then "--debug" else "" } \ + --user="gnunetd" \ + --config="${configFile}" \ --log="${cfg.logLevel}" ''; };