diff options
author | makefu <github@syntax-fehler.de> | 2016-08-22 18:39:14 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2016-08-22 18:39:14 +0200 |
commit | 0a80e273206f886ae3996dedae215ecd9b16f6ad (patch) | |
tree | 270f0dbdbc66ed217822b1e259bb08f57009a8a1 /3modules/opentracker.nix | |
parent | a59d11f3a2cd1fd1b9cd27f27c59fe88be50b136 (diff) |
m 3 opentracker: init
Diffstat (limited to '3modules/opentracker.nix')
-rw-r--r-- | 3modules/opentracker.nix | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/3modules/opentracker.nix b/3modules/opentracker.nix new file mode 100644 index 000000000..8847fc09a --- /dev/null +++ b/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 + |