diff options
-rw-r--r-- | makefu/3modules/default.nix | 7 | ||||
-rw-r--r-- | makefu/3modules/ps3netsrv.nix | 58 | ||||
-rw-r--r-- | makefu/5pkgs/ps3netsrv/default.nix | 2 |
3 files changed, 63 insertions, 4 deletions
diff --git a/makefu/3modules/default.nix b/makefu/3modules/default.nix index febebaa18..7fc095bab 100644 --- a/makefu/3modules/default.nix +++ b/makefu/3modules/default.nix @@ -2,11 +2,12 @@ _: { imports = [ - ./snapraid.nix - ./umts.nix - ./taskserver.nix ./awesome-extra.nix ./forward-journal.nix + ./ps3netsrv.nix + ./snapraid.nix + ./taskserver.nix + ./umts.nix ]; } 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 + diff --git a/makefu/5pkgs/ps3netsrv/default.nix b/makefu/5pkgs/ps3netsrv/default.nix index 904185934..f62ee0c9a 100644 --- a/makefu/5pkgs/ps3netsrv/default.nix +++ b/makefu/5pkgs/ps3netsrv/default.nix @@ -10,7 +10,7 @@ stdenv.mkDerivation rec { url = "https://github.com/dirkvdb/ps3netsrv--"; fetchSubmodules = true; rev = "e54a66cbf142b86e2cffc1701984b95adb921e81"; # latest @ 2016-05-24 - sha256 = "0l7bp18cs3xr2qgsmcf18diccski49mj9whngxm9isi8wd4r9inj"; + sha256 = "09hvmfzqy2jckpsml0z1gkcnar8sigmgs1q66k718fph2d3g54sa"; }; nativeBuildInputs = [ gnugrep ]; |