m ps3netsrv: init

This commit is contained in:
makefu 2016-07-28 12:59:29 +02:00
parent b156915805
commit 469fc88a6f
No known key found for this signature in database
GPG Key ID: 36F7711F3FC0F225
3 changed files with 63 additions and 4 deletions

View File

@ -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
];
}

View File

@ -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

View File

@ -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 ];