at 15.09-beta 3.2 kB view raw
1{ config, lib, pkgs, ... }: 2 3let 4 cfg = config.services.fuppesd; 5in 6 7with lib; 8 9{ 10 options = { 11 services.fuppesd = { 12 enable = mkOption { 13 default = false; 14 type = with types; bool; 15 description = '' 16 Enables Fuppes (UPnP A/V Media Server). Can be used to watch 17 photos, video and listen to music from a phone/tv connected to the 18 local network. 19 ''; 20 }; 21 22 name = mkOption { 23 example = "Media Center"; 24 type = types.str; 25 description = '' 26 Enables Fuppes (UPnP A/V Media Server). Can be used to watch 27 photos, video and listen to music from a phone/tv connected to the 28 local network. 29 ''; 30 }; 31 32 log = { 33 level = mkOption { 34 default = 0; 35 example = 3; 36 type = with types; uniq int; 37 description = '' 38 Logging level of fuppes, An integer between 0 and 3. 39 ''; 40 }; 41 42 file = mkOption { 43 default = "/var/log/fuppes.log"; 44 type = types.str; 45 description = '' 46 File which will contains the log produced by the daemon. 47 ''; 48 }; 49 }; 50 51 config = mkOption { 52 example = "/etc/fuppes/fuppes.cfg"; 53 type = types.str; 54 description = '' 55 Mutable configuration file which can be edited with the web 56 interface. Due to possible modification, double quote the full 57 path of the filename stored in your filesystem to avoid attempts 58 to modify the content of the nix store. 59 ''; 60 }; 61 62 vfolder = mkOption { 63 example = literalExample "/etc/fuppes/vfolder.cfg"; 64 description = '' 65 XML file describing the layout of virtual folder visible by the 66 client. 67 ''; 68 }; 69 70 database = mkOption { 71 default = "/var/lib/fuppes/fuppes.db"; 72 type = types.str; 73 description = '' 74 Database file which index all shared files. 75 ''; 76 }; 77 78 ## At the moment, no plugins are packaged. 79 /* 80 plugins = mkOption { 81 type = with types; listOf package; 82 description = '' 83 List of Fuppes plugins. 84 ''; 85 }; 86 */ 87 88 user = mkOption { 89 default = "root"; # The default is not secure. 90 example = "fuppes"; 91 type = types.str; 92 description = '' 93 Name of the user which own the configuration files and under which 94 the fuppes daemon will be executed. 95 ''; 96 }; 97 98 }; 99 }; 100 101 config = mkIf cfg.enable { 102 jobs.fuppesd = { 103 description = "UPnP A/V Media Server. (${cfg.name})"; 104 startOn = "ip-up"; 105 daemonType = "fork"; 106 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}''; 107 }; 108 109 services.fuppesd.name = mkDefault config.networking.hostName; 110 111 services.fuppesd.vfolder = mkDefault ./fuppes/vfolder.cfg; 112 113 security.sudo.enable = true; 114 }; 115}