git.iko.soy/typeable/nixpkgs
on master help sign in
nixos.roon-bridge: init
commitc8f95fd174a46078d1468f19a9192f0fee1b4cd6 authorBernardo Meurer <bernardo@meurer.org> dateFri 12 Feb 2021, 22:45 (6 years ago) parent2bac6a4
2 files changed+81−7
nixos/modules/services/audio/roon-bridge.nix+74 pkgs/servers/roon-bridge/default.nix+7−7
nixos/modules/services/audio/roon-bridge.nixnew file+74
@@ -0,0 +1,74 @@
1+{ config, lib, pkgs, ... }:
2+
3+with lib;
4+
5+let
6+ name = "roon-bridge";
7+ cfg = config.services.roon-bridge;
8+in {
9+ options = {
10+ services.roon-bridge = {
11+ enable = mkEnableOption "Roon Bridge";
12+ openFirewall = mkOption {
13+ type = types.bool;
14+ default = false;
15+ description = ''
16+ Open ports in the firewall for the bridge.
17+
18+ UDP: 9003
19+ TCP: 9100 - 9200
20+ '';
21+ };
22+ user = mkOption {
23+ type = types.str;
24+ default = "roon-bridge";
25+ description = ''
26+ User to run the Roon bridge as.
27+ '';
28+ };
29+ group = mkOption {
30+ type = types.str;
31+ default = "roon-bridge";
32+ description = ''
33+ Group to run the Roon Bridge as.
34+ '';
35+ };
36+ };
37+ };
38+
39+ config = mkIf cfg.enable {
40+ systemd.services.roon-bridge = {
41+ after = [ "network.target" ];
42+ description = "Roon Bridge";
43+ wantedBy = [ "multi-user.target" ];
44+
45+ environment.ROON_DATAROOT = "/var/lib/${name}";
46+
47+ serviceConfig = {
48+ ExecStart = "${pkgs.roon-bridge}/start.sh";
49+ LimitNOFILE = 8192;
50+ User = cfg.user;
51+ Group = cfg.group;
52+ StateDirectory = name;
53+ };
54+ };
55+
56+ networking.firewall = mkIf cfg.openFirewall {
57+ allowedTCPPortRanges = [
58+ { from = 9100; to = 9200; }
59+ ];
60+ allowedUDPPorts = [ 9003 ];
61+ };
62+
63+
64+ users.groups.${cfg.group} = {};
65+ users.users.${cfg.user} =
66+ if cfg.user == "roon-bridge" then {
67+ isSystemUser = true;
68+ description = "Roon Bridge user";
69+ group = cfg.group;
70+ extraGroups = [ "audio" ];
71+ }
72+ else {};
73+ };
74+}
pkgs/servers/roon-bridge/default.nix+7−7
@@ -1,5 +1,5 @@
1−{ alsaLib
2−, alsaUtils
1+{ alsa-lib
2+, alsa-utils
33, autoPatchelfHook
44, fetchurl
55, lib
@@ -10,20 +10,20 @@
1010
1111stdenv.mkDerivation rec {
1212 pname = "roon-bridge";
13− version = "100800753";
13+ version = "1.8-795";
1414
1515 # N.B. The URL is unstable. I've asked for them to provide a stable URL but
1616 # they have ignored me. If this package fails to build for you, you may need
1717 # to update the version and sha256.
1818 # c.f. https://community.roonlabs.com/t/latest-roon-server-is-not-available-for-download-on-nixos/118129
1919 src = fetchurl {
20− url = "https://web.archive.org/web/20201221152142/http://download.roonlabs.com/builds/RoonBridge_linuxx64.tar.bz2";
20+ url = "https://web.archive.org/web/20210610172810/http://download.roonlabs.com/builds/RoonBridge_linuxx64.tar.bz2";
2121 sha256 = "sha256-ahdy0/TBOyMfCt4VTkcDTZGAFmwQJT2KvZuMtFcAY3w=";
2222 };
2323
2424 buildInputs = [
25− alsaLib
26− alsaUtils
25+ alsa-lib
26+ alsa-utils
2727 zlib
2828 ];
2929
@@ -44,7 +44,7 @@ stdenv.mkDerivation rec {
4444 ln -sf $out/RoonMono/bin/mono-sgen $out/RoonMono/bin/${builtins.baseNameOf bin}
4545 '';
4646 wrapFix = bin: ''
47− wrapProgram ${bin} --prefix PATH : ${lib.makeBinPath [ alsaUtils ]}
47+ wrapProgram ${bin} --prefix PATH : ${lib.makeBinPath [ alsa-utils ]}
4848 '';
4949 in
5050 ''