2014-04-14 15:26:48 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
2011-07-27 21:55:28 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.fuppesd;
|
|
|
|
in
|
|
|
|
|
2014-04-14 15:26:48 +01:00
|
|
|
with lib;
|
2011-07-27 21:55:28 +01:00
|
|
|
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
services.fuppesd = {
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = with types; bool;
|
|
|
|
description = ''
|
|
|
|
Enables Fuppes (UPnP A/V Media Server). Can be used to watch
|
|
|
|
photos, video and listen to music from a phone/tv connected to the
|
|
|
|
local network.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
name = mkOption {
|
|
|
|
example = "Media Center";
|
2013-10-30 10:02:04 +00:00
|
|
|
type = types.str;
|
2011-07-27 21:55:28 +01:00
|
|
|
description = ''
|
|
|
|
Enables Fuppes (UPnP A/V Media Server). Can be used to watch
|
|
|
|
photos, video and listen to music from a phone/tv connected to the
|
|
|
|
local network.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
log = {
|
|
|
|
level = mkOption {
|
|
|
|
default = 0;
|
|
|
|
example = 3;
|
|
|
|
type = with types; uniq int;
|
|
|
|
description = ''
|
|
|
|
Logging level of fuppes, An integer between 0 and 3.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
file = mkOption {
|
|
|
|
default = "/var/log/fuppes.log";
|
2013-10-30 10:02:04 +00:00
|
|
|
type = types.str;
|
2011-07-27 21:55:28 +01:00
|
|
|
description = ''
|
|
|
|
File which will contains the log produced by the daemon.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkOption {
|
|
|
|
example = "/etc/fuppes/fuppes.cfg";
|
2013-10-30 10:02:04 +00:00
|
|
|
type = types.str;
|
2011-07-27 21:55:28 +01:00
|
|
|
description = ''
|
|
|
|
Mutable configuration file which can be edited with the web
|
|
|
|
interface. Due to possible modification, double quote the full
|
|
|
|
path of the filename stored in your filesystem to avoid attempts
|
|
|
|
to modify the content of the nix store.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
vfolder = mkOption {
|
2013-10-23 19:06:39 +01:00
|
|
|
example = literalExample "/etc/fuppes/vfolder.cfg";
|
2011-07-27 21:55:28 +01:00
|
|
|
description = ''
|
|
|
|
XML file describing the layout of virtual folder visible by the
|
|
|
|
client.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
database = mkOption {
|
|
|
|
default = "/var/lib/fuppes/fuppes.db";
|
2013-10-30 10:02:04 +00:00
|
|
|
type = types.str;
|
2011-07-27 21:55:28 +01:00
|
|
|
description = ''
|
|
|
|
Database file which index all shared files.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
## At the moment, no plugins are packaged.
|
|
|
|
/*
|
|
|
|
plugins = mkOption {
|
|
|
|
type = with types; listOf package;
|
|
|
|
description = ''
|
|
|
|
List of Fuppes plugins.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
*/
|
|
|
|
|
|
|
|
user = mkOption {
|
|
|
|
default = "root"; # The default is not secure.
|
|
|
|
example = "fuppes";
|
2013-10-30 10:02:04 +00:00
|
|
|
type = types.str;
|
2011-07-27 21:55:28 +01:00
|
|
|
description = ''
|
|
|
|
Name of the user which own the configuration files and under which
|
|
|
|
the fuppes daemon will be executed.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
jobs.fuppesd = {
|
|
|
|
description = "UPnP A/V Media Server. (${cfg.name})";
|
|
|
|
startOn = "ip-up";
|
|
|
|
daemonType = "fork";
|
|
|
|
exec = ''/var/setuid-wrappers/sudo -u ${cfg.user} -- ${pkgs.fuppes}/bin/fuppesd --friendly-name ${cfg.name} --log-level ${toString cfg.log.level} --log-file ${cfg.log.file} --config-file ${cfg.config} --vfolder-config-file ${cfg.vfolder} --database-file ${cfg.database}'';
|
|
|
|
};
|
|
|
|
|
|
|
|
services.fuppesd.name = mkDefault config.networking.hostName;
|
|
|
|
|
2013-10-23 19:06:39 +01:00
|
|
|
services.fuppesd.vfolder = mkDefault ./fuppes/vfolder.cfg;
|
|
|
|
|
2011-07-27 21:55:28 +01:00
|
|
|
security.sudo.enable = true;
|
|
|
|
};
|
|
|
|
}
|