summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------custom/trivmix0
-rw-r--r--custom/trivmix-service.nix59
2 files changed, 25 insertions, 34 deletions
diff --git a/custom/trivmix b/custom/trivmix
Subproject 6454da50559e0eee810f81d33365a621857d806 Subproject 2f5f880136f3411e7e8d919631e71ef05d0ae9a
diff --git a/custom/trivmix-service.nix b/custom/trivmix-service.nix
index 5e0e5b47..56b26b6f 100644
--- a/custom/trivmix-service.nix
+++ b/custom/trivmix-service.nix
@@ -9,44 +9,35 @@
9, makeWrapper 9, makeWrapper
10, jack2Full 10, jack2Full
11, coreutils 11, coreutils
12, writeScript
12}: 13}:
13 14
14let 15let
15 genRun = if ! isNull run then run else ( 16 connect = (! isNull connectOut) || (! isNull connectIn);
16 "${derivRun}/bin/run.sh" 17 connectScript = writeScript "connect" ''
17 ); 18 #!${stdenv.shell}
18 derivRun = stdenv.mkDerivation {
19 name = "trivmix-run";
20 src = builtins.toFile "run.sh" ''
21 #!/bin/sh
22 19
23 ${if ! isNull connectIn then "jack_connect ${connectIn} $1" else ""} 20 ${optionalString (! isNull connectIn) "jack_connect ${connectIn} $1"}
24 ${if ! isNull connectOut then "jack_connect $2 ${connectOut}" else ""} 21 ${optionalString (! isNull connectOut) "jack_connect $2 ${connectOu}"}
25 ''; 22 '';
26 unpackPhase = "cat";
27 buildInputs = [ makeWrapper ];
28 installPhase = ''
29 mkdir -p $out/bin
30 cp $src $out/bin/run.sh
31 chmod 755 $out/bin/run.sh
32 wrapProgram $out/bin/run.sh \
33 --prefix PATH : ${jack2Full}/bin
34 '';
35 };
36 inherit (stdenv.lib) optionalString; 23 inherit (stdenv.lib) optionalString;
37in rec { 24in {
38 out = { 25 wantedBy = [ "sound.target" ];
39 wantedBy = [ "sound.target" ]; 26 requires = [ "jack.service" ];
40 requires = [ "jack.service" ]; 27 before = [ "mpd.service" ];
41 before = [ "mpd.service" ]; 28 serviceConfig = {
42 serviceConfig = { 29 Type = "simple";
43 Type = "simple"; 30 ExecStart = ''${trivmix}/bin/trivmix --client ${name} \
44 ExecStart = ''${trivmix}/bin/trivmix --client ${name} --run ${genRun}${optionalString (initial != null) " --level ${initial}"} /dev/shm/mix/${name}/level${if ! isNull group then " /dev/shm/mix/${group}/level" else ""}''; 31 ${optionalString connect "--run ${connectScript}"} \
45 User = "jack"; 32 ${optionalString (! isNull run) "--run ${run}"} \
46 Group = "audio"; 33 ${optionalString (! isNull initial) "--level ${initial}"} \
47 Nice = "-10"; 34 /dev/shm/mix/${name}/level \
48 LimitRTPRIO = "95:95"; 35 ${optionalString (! isNull group) "/dev/shm/mix/${group}/level"}
49 LimitMEMLOCK = "infinity"; 36 '';
50 }; 37 User = "jack";
38 Group = "audio";
39 Nice = "-10";
40 LimitRTPRIO = "95:95";
41 LimitMEMLOCK = "infinity";
51 }; 42 };
52} 43}