summaryrefslogtreecommitdiffstats
path: root/makefu/3modules/ps3netsrv.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2016-08-02 20:58:42 +0200
committertv <tv@krebsco.de>2016-08-02 20:58:42 +0200
commite6aef09ad41cd55d716b8ee276ebd774b95d8ecb (patch)
tree6d8d5cce976f3843ab196367e82fec56f0798838 /makefu/3modules/ps3netsrv.nix
parent0928cc03a6191640c66c9122159994855527faef (diff)
parentb197949ab83ee3ee87b5774e0fc7c8d0123a6708 (diff)
Merge remote-tracking branch 'gum/master'
Diffstat (limited to 'makefu/3modules/ps3netsrv.nix')
-rw-r--r--makefu/3modules/ps3netsrv.nix58
1 files changed, 58 insertions, 0 deletions
diff --git a/makefu/3modules/ps3netsrv.nix b/makefu/3modules/ps3netsrv.nix
new file mode 100644
index 000000000..22681637c
--- /dev/null
+++ b/makefu/3modules/ps3netsrv.nix
@@ -0,0 +1,58 @@
+{ config, lib, pkgs, ... }:
+
+with config.krebs.lib;
+let
+ cfg = config.makefu.ps3netsrv;
+
+ out = {
+ options.makefu.ps3netsrv = api;
+ config = lib.mkIf cfg.enable imp;
+ };
+
+ api = {
+ enable = mkEnableOption "ps3netsrv";
+
+ servedir = mkOption {
+ description = "path to serve, must be set";
+ type = types.str;
+ };
+
+ package = mkOption {
+ type = types.package;
+ default = pkgs.ps3netsrv;
+ };
+
+ user = mkOption {
+ description = ''user which will run ps3netsrv'';
+ type = types.str;
+ default = "ps3netsrv";
+ };
+ };
+
+ imp = {
+ systemd.services.ps3netsrv = {
+ description = "ps3netsrv server";
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+ restartIfChanged = true;
+ unitConfig = {
+ Documentation = "https://www.arm-blog.com/playing-ps3-games-from-your-nas/" ;
+ ConditionPathExists = cfg.servedir;
+ };
+ serviceConfig = {
+ Type = "simple";
+ ExecStart = "${cfg.package}/bin/ps3netsrv++ ${shell.escape cfg.servedir}";
+ PrivateTmp = true;
+ User = "${cfg.user}";
+ };
+ };
+
+ # TODO only create if user is ps3netsrv
+ users.users.ps3netsrv = {
+ uid = genid "ps3netsrv";
+ };
+ users.groups.ps3netsrv.gid = genid "ps3netsrv";
+ };
+in
+out
+