diff options
author | lassulus <lass@aidsballs.de> | 2016-08-21 13:16:56 +0200 |
---|---|---|
committer | lassulus <lass@aidsballs.de> | 2016-08-21 13:16:56 +0200 |
commit | d50198d880c4be21413f9bb536b784005204beb9 (patch) | |
tree | 28ea56d3694e7239e532474f677a95f6604c00c5 /makefu/3modules/udpt.nix | |
parent | 3eb5f58a0ee9778006d4e37fee17e0b3e096a52a (diff) | |
parent | d1c4d12cee228cba1da4da7bba82b6cf6cb708ec (diff) |
Merge remote-tracking branch 'gum/master'
Diffstat (limited to 'makefu/3modules/udpt.nix')
-rw-r--r-- | makefu/3modules/udpt.nix | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/makefu/3modules/udpt.nix b/makefu/3modules/udpt.nix new file mode 100644 index 000000000..2086bd540 --- /dev/null +++ b/makefu/3modules/udpt.nix @@ -0,0 +1,57 @@ +{ config, lib, pkgs, ... }: + +with config.krebs.lib; +let + cfg = config.makefu.udpt; + + out = { + options.makefu.udpt = api; + config = lib.mkIf cfg.enable imp; + }; + + api = { + enable = mkEnableOption "udpt"; + + package = mkOption { + type = types.package; + default = pkgs.udpt; + }; + + cfgfile = mkOption { + type = types.path; + default = "${cfg.package}/etc/udpt.conf"; + }; + + user = mkOption { + description = '' + user which will run udpt. if kept default a new user will be created + ''; + type = types.str; + default = "udpt"; + }; + + }; + + imp = { + systemd.services.udpt = { + description = "udpt server"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + restartIfChanged = true; + serviceConfig = { + Type = "simple"; + ExecStart = "${cfg.package}/bin/udpt -c ${shell.escape cfg.cfgfile}"; + PrivateTmp = true; + User = "${cfg.user}"; + }; + }; + users = lib.mkIf (cfg.user == "udpt") { + users.udpt = { + uid = genid "udpt"; + }; + groups.udpt.gid = genid "udpt"; + }; + }; +in +out + |