summaryrefslogtreecommitdiff
path: root/custom/trivmix-service.nix
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2017-03-09 13:52:21 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2017-03-09 13:52:21 +0100
commit0631b6b91d79c55a4b3527719c6dc6b851369f3c (patch)
tree4fa027e3d133c598611c07132ab4145d42f455f4 /custom/trivmix-service.nix
parent6fe2b6698f801d8f1e3d9b8a6a5b8db321481a45 (diff)
downloadnixos-0631b6b91d79c55a4b3527719c6dc6b851369f3c.tar
nixos-0631b6b91d79c55a4b3527719c6dc6b851369f3c.tar.gz
nixos-0631b6b91d79c55a4b3527719c6dc6b851369f3c.tar.bz2
nixos-0631b6b91d79c55a4b3527719c6dc6b851369f3c.tar.xz
nixos-0631b6b91d79c55a4b3527719c6dc6b851369f3c.zip
Bump trivmix
Diffstat (limited to 'custom/trivmix-service.nix')
-rw-r--r--custom/trivmix-service.nix59
1 files changed, 25 insertions, 34 deletions
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}