summaryrefslogtreecommitdiffstats
path: root/makefu/3modules/ps3netsrv.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2016-07-28 12:59:29 +0200
committermakefu <github@syntax-fehler.de>2016-07-28 13:23:59 +0200
commit469fc88a6f4015dc1a71bc668107488fdb6a4a52 (patch)
tree894560c1d68e3566ac48645361c793bb81746c21 /makefu/3modules/ps3netsrv.nix
parentb1569158057042aa50e6816e38f0305bab8e5f9c (diff)
m ps3netsrv: init
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 00000000..22681637
--- /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
+