stockholm/makefu/3modules/opentracker.nix

56 lines
1.2 KiB
Nix
Raw Normal View History

2016-08-22 16:39:14 +00:00
{ config, lib, pkgs, ... }:
2016-10-20 18:54:38 +00:00
with import <stockholm/lib>;
2016-08-22 16:39:14 +00:00
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 {
2019-10-15 06:47:31 +00:00
type = types.separatedString;
2016-08-22 16:39:14 +00:00
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