diff options
author | makefu <github@syntax-fehler.de> | 2016-08-21 11:53:58 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2016-08-21 11:53:58 +0200 |
commit | 96f862ced4e621f88bcbf7d1ad4ea1d8422f53d7 (patch) | |
tree | 386d6562f1e4fec927fec2ebab9c629bd7cb5753 | |
parent | a20c72f58842eebc6f6823397b90a60ae64e44b7 (diff) |
m 3 udpt: init
-rw-r--r-- | makefu/3modules/default.nix | 4 | ||||
-rw-r--r-- | makefu/3modules/udpt.nix | 57 |
2 files changed, 60 insertions, 1 deletions
diff --git a/makefu/3modules/default.nix b/makefu/3modules/default.nix index bdba4ae46..031ef1bc2 100644 --- a/makefu/3modules/default.nix +++ b/makefu/3modules/default.nix @@ -2,13 +2,15 @@ _: { imports = [ + ./populate.nix ./awesome-extra.nix + ./deluge.nix ./forward-journal.nix ./ps3netsrv.nix ./snapraid.nix ./taskserver.nix + ./udpt.nix ./umts.nix - ./deluge.nix ]; } 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 + |