diff options
author | Ludovic Courtès <ludo@gnu.org> | 2008-09-04 20:28:02 +0000 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2008-09-04 20:28:02 +0000 |
commit | e15ffa9e3c5a1059b8840338ffc33dda46f28c4e (patch) | |
tree | 8544dc4ee007d39253ced4dcfa636e568aeeb42d /upstart-jobs/gnunet.nix | |
parent | ab80a34ea45b060ce3a83c27ca995a300a442e91 (diff) | |
download | nixpkgs-e15ffa9e3c5a1059b8840338ffc33dda46f28c4e.tar nixpkgs-e15ffa9e3c5a1059b8840338ffc33dda46f28c4e.tar.gz nixpkgs-e15ffa9e3c5a1059b8840338ffc33dda46f28c4e.tar.bz2 nixpkgs-e15ffa9e3c5a1059b8840338ffc33dda46f28c4e.tar.lz nixpkgs-e15ffa9e3c5a1059b8840338ffc33dda46f28c4e.tar.xz nixpkgs-e15ffa9e3c5a1059b8840338ffc33dda46f28c4e.tar.zst nixpkgs-e15ffa9e3c5a1059b8840338ffc33dda46f28c4e.zip |
Add `gnunetd' Upstart job.
svn path=/nixos/trunk/; revision=12802
Diffstat (limited to 'upstart-jobs/gnunet.nix')
-rw-r--r-- | upstart-jobs/gnunet.nix | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/upstart-jobs/gnunet.nix b/upstart-jobs/gnunet.nix new file mode 100644 index 00000000000..3b3de2d97b3 --- /dev/null +++ b/upstart-jobs/gnunet.nix @@ -0,0 +1,64 @@ +{ gnunet, gnunetConfig, lib, writeText }: + +assert gnunetConfig.enable; + +{ + name = "gnunetd"; + + users = [ + { name = "gnunetd"; + uid = (import ../system/ids.nix).uids.gnunetd; + description = "GNUnet Daemon User"; + home = "/var/empty"; + } + ]; + + job = + with gnunetConfig; + let configFile = writeText "gnunetd.conf" '' + [PATHS] + GNUNETD_HOME = ${home} + + [GNUNETD] + HOSTLISTURL = ${lib.concatStringsSep " " hostLists} + APPLICATIONS = ${lib.concatStringsSep " " applications} + TRANSPORTS = ${lib.concatStringsSep " " transports} + + [LOAD] + MAXNETDOWNBPSTOTAL = ${toString load.maxNetDownBandwidth} + MAXNETUPBPSTOTAL = ${toString load.maxNetUpBandwidth} + HARDUPLIMIT = ${toString load.hardNetUpBandwidth} + MAXCPULOAD = ${toString load.maxCPULoad} + INTERFACES = ${lib.concatStringsSep " " load.interfaces} + + [FS] + QUOTA = ${toString fileSharing.quota} + ACTIVEMIGRATION = ${if fileSharing.activeMigration then "YES" else "NO"} + + [MODULES] + sqstore = sqstore_sqlite + dstore = dstore_sqlite + topology = topology_default + + ${extraOptions} + ''; + + in '' +description "The GNUnet Daemon" + +start on network-interfaces/started +stop on network-interfaces/stop + +start script + test -d "${home}" || \ + ( mkdir -m 755 -p "${home}" && chown -R gnunetd:users "${home}") +end script + +respawn ${gnunet}/bin/gnunetd \ + ${if debug then "--debug" else "" } \ + --user="gnunetd" \ + --config="${configFile}" \ + --log="${logLevel}" +''; + +} |