From 3006c2b13637bd2038a3e7baac42d016ae56a41f Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 22 Aug 2016 18:39:14 +0200 Subject: m 3 opentracker: init --- makefu/3modules/opentracker.nix | 55 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 makefu/3modules/opentracker.nix (limited to 'makefu/3modules') diff --git a/makefu/3modules/opentracker.nix b/makefu/3modules/opentracker.nix new file mode 100644 index 000000000..8847fc09a --- /dev/null +++ b/makefu/3modules/opentracker.nix @@ -0,0 +1,55 @@ +{ config, lib, pkgs, ... }: + +with config.krebs.lib; +let + cfg = config.makefu.opentracker; + + out = { + options.makefu.opentracker = api; + config = lib.mkIf cfg.enable imp; + }; + + api = { + enable = mkEnableOption "opentracker"; + + package = mkOption { + type = types.package; + default = pkgs.opentracker; + }; + + args = mkOption { + type = types.string; + description = '' + see https://erdgeist.org/arts/software/opentracker/ for all params + ''; + default = ""; + }; + + user = mkOption { + description = '' + user which will run opentracker. by default opentracker drops all + privileges and runs in chroot after starting up as root. + ''; + type = types.str; + default = "root"; + }; + }; + + imp = { + systemd.services.opentracker = { + description = "opentracker server"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + restartIfChanged = true; + serviceConfig = { + Type = "simple"; + ExecStart = "${cfg.package}/bin/opentracker ${cfg.args}"; + PrivateTmp = true; + WorkingDirectory = "/tmp"; + User = "${cfg.user}"; + }; + }; + }; +in +out + -- cgit v1.2.3