2016-07-28 10:59:29 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
2016-10-20 18:54:38 +00:00
|
|
|
with import <stockholm/lib>;
|
2016-07-28 10:59:29 +00:00
|
|
|
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";
|
2021-06-05 13:52:06 +00:00
|
|
|
isSystemUser = true;
|
2021-12-04 19:46:47 +00:00
|
|
|
group = "ps3netsrv";
|
2016-07-28 10:59:29 +00:00
|
|
|
};
|
|
|
|
users.groups.ps3netsrv.gid = genid "ps3netsrv";
|
|
|
|
};
|
|
|
|
in
|
|
|
|
out
|
|
|
|
|