lol

Merge pull request #133603 from lovesegfault/hqplayerd-settings

nixos/hqplayerd: allow configuration from Nix

authored by

Bernardo Meurer and committed by
GitHub
d11ed566 1811c646

+26 -13
+26 -13
nixos/modules/services/audio/hqplayerd.nix
··· 14 14 services.hqplayerd = { 15 15 enable = mkEnableOption "HQPlayer Embedded"; 16 16 17 - licenseFile = mkOption { 18 - type = types.nullOr types.path; 19 - default = null; 20 - description = '' 21 - Path to the HQPlayer license key file. 22 - 23 - Without this, the service will run in trial mode and restart every 30 24 - minutes. 25 - ''; 26 - }; 27 - 28 17 auth = { 29 18 username = mkOption { 30 19 type = types.nullOr types.str; ··· 49 38 }; 50 39 }; 51 40 41 + licenseFile = mkOption { 42 + type = types.nullOr types.path; 43 + default = null; 44 + description = '' 45 + Path to the HQPlayer license key file. 46 + 47 + Without this, the service will run in trial mode and restart every 30 48 + minutes. 49 + ''; 50 + }; 51 + 52 52 openFirewall = mkOption { 53 53 type = types.bool; 54 54 default = false; 55 55 description = '' 56 - Open TCP port 8088 in the firewall for the server. 56 + Opens ports needed for the WebUI and controller API. 57 + ''; 58 + }; 59 + 60 + config = mkOption { 61 + type = types.nullOr types.lines; 62 + default = null; 63 + description = '' 64 + HQplayer daemon configuration, written to /etc/hqplayer/hqplayerd.xml. 65 + 66 + Refer to ${pkg}/share/doc/hqplayerd/readme.txt for possible values. 57 67 ''; 58 68 }; 59 69 }; ··· 70 80 71 81 environment = { 72 82 etc = { 83 + "hqplayer/hqplayerd.xml" = mkIf (cfg.config != null) { source = pkgs.writeText "hqplayerd.xml" cfg.config; }; 73 84 "hqplayer/hqplayerd4-key.xml" = mkIf (cfg.licenseFile != null) { source = cfg.licenseFile; }; 74 85 "modules-load.d/taudio2.conf".source = "${pkg}/etc/modules-load.d/taudio2.conf"; 75 86 }; ··· 77 88 }; 78 89 79 90 networking.firewall = mkIf cfg.openFirewall { 80 - allowedTCPPorts = [ 8088 ]; 91 + allowedTCPPorts = [ 8088 4321 ]; 81 92 }; 82 93 83 94 services.udev.packages = [ pkg ]; ··· 98 109 environment.HOME = "${stateDir}/home"; 99 110 100 111 unitConfig.ConditionPathExists = [ configDir stateDir ]; 112 + 113 + restartTriggers = [ config.environment.etc."hqplayer/hqplayerd.xml".source ]; 101 114 102 115 preStart = '' 103 116 cp -r "${pkg}/var/lib/hqplayer/web" "${stateDir}"