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 services.hqplayerd = { 15 enable = mkEnableOption "HQPlayer Embedded"; 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 auth = { 29 username = mkOption { 30 type = types.nullOr types.str; ··· 49 }; 50 }; 51 52 openFirewall = mkOption { 53 type = types.bool; 54 default = false; 55 description = '' 56 - Open TCP port 8088 in the firewall for the server. 57 ''; 58 }; 59 }; ··· 70 71 environment = { 72 etc = { 73 "hqplayer/hqplayerd4-key.xml" = mkIf (cfg.licenseFile != null) { source = cfg.licenseFile; }; 74 "modules-load.d/taudio2.conf".source = "${pkg}/etc/modules-load.d/taudio2.conf"; 75 }; ··· 77 }; 78 79 networking.firewall = mkIf cfg.openFirewall { 80 - allowedTCPPorts = [ 8088 ]; 81 }; 82 83 services.udev.packages = [ pkg ]; ··· 98 environment.HOME = "${stateDir}/home"; 99 100 unitConfig.ConditionPathExists = [ configDir stateDir ]; 101 102 preStart = '' 103 cp -r "${pkg}/var/lib/hqplayer/web" "${stateDir}"
··· 14 services.hqplayerd = { 15 enable = mkEnableOption "HQPlayer Embedded"; 16 17 auth = { 18 username = mkOption { 19 type = types.nullOr types.str; ··· 38 }; 39 }; 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 openFirewall = mkOption { 53 type = types.bool; 54 default = false; 55 description = '' 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. 67 ''; 68 }; 69 }; ··· 80 81 environment = { 82 etc = { 83 + "hqplayer/hqplayerd.xml" = mkIf (cfg.config != null) { source = pkgs.writeText "hqplayerd.xml" cfg.config; }; 84 "hqplayer/hqplayerd4-key.xml" = mkIf (cfg.licenseFile != null) { source = cfg.licenseFile; }; 85 "modules-load.d/taudio2.conf".source = "${pkg}/etc/modules-load.d/taudio2.conf"; 86 }; ··· 88 }; 89 90 networking.firewall = mkIf cfg.openFirewall { 91 + allowedTCPPorts = [ 8088 4321 ]; 92 }; 93 94 services.udev.packages = [ pkg ]; ··· 109 environment.HOME = "${stateDir}/home"; 110 111 unitConfig.ConditionPathExists = [ configDir stateDir ]; 112 + 113 + restartTriggers = [ config.environment.etc."hqplayer/hqplayerd.xml".source ]; 114 115 preStart = '' 116 cp -r "${pkg}/var/lib/hqplayer/web" "${stateDir}"