diff options
author | lassulus <lass@lassul.us> | 2017-05-23 20:36:23 +0200 |
---|---|---|
committer | lassulus <lass@lassul.us> | 2017-05-23 20:36:23 +0200 |
commit | ad1e4cb239bfbb39be977c3fdf2f5f172bb5a4f5 (patch) | |
tree | 5b98dbbc1184252108e9eaa1c878293568af9295 /lass/3modules/pyload.nix | |
parent | d1321d64118fa50d0082e79a8fc74613aa0cb66a (diff) |
l 3 pyload: init
Diffstat (limited to 'lass/3modules/pyload.nix')
-rw-r--r-- | lass/3modules/pyload.nix | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/lass/3modules/pyload.nix b/lass/3modules/pyload.nix new file mode 100644 index 000000000..6f29ffb17 --- /dev/null +++ b/lass/3modules/pyload.nix @@ -0,0 +1,55 @@ +{ config, lib, pkgs, ... }: + +with import <stockholm/lib>; + +let + cfg = config.lass.pyload; + + out = { + options.lass.pyload = api; + config = lib.mkIf cfg.enable imp; + }; + + api = { + enable = mkEnableOption "pyload"; + user = mkOption { + type = types.str; + default = "download"; + }; + }; + + imp = { + + krebs.per-user.${cfg.user}.packages = [ + pkgs.pyload + pkgs.spidermonkey + pkgs.tesseract + ]; + + krebs.iptables.tables.filter.INPUT.rules = [ + { predicate = "-p tcp --dport 9099"; target = "ACCEPT"; } + ]; + systemd.services.pyload = { + description = "pyload"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + + path = with pkgs; [ + pyload + spidermonkey + tesseract + dnsmasq + ]; + + restartIfChanged = true; + + serviceConfig = { + Restart = "always"; + ExecStart = "${pkgs.pyload}/bin/pyLoadCore"; + User = cfg.user; + }; + }; + + }; + +in out |