blob: 44044504d4f726e663cd3f7f911245105a746eb2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
{ name
, run ? null
, connectOut ? null
, connectIn ? null
, group ? null
, initial ? null
, adjustable ? true
, trivmix
, stdenv
, makeWrapper
, jack2Full
, coreutils
, writeScript
}:
let
connect = (! isNull connectOut) || (! isNull connectIn);
connectScript = writeScript "connect" ''
#!${stdenv.shell}
PATH=${jack2Full}/bin:$PATH
${optionalString (! isNull connectIn) "jack_connect ${connectIn} $1"}
${optionalString (! isNull connectOut) "jack_connect $2 ${connectOut}"}
'';
inherit (stdenv.lib) optionalString;
in {
out = {
wantedBy = [ "sound.target" ];
requires = [ "jack.service" ];
before = [ "mpd.service" ];
serviceConfig = {
Type = "simple";
ExecStart = ''${trivmix}/bin/trivmix --client ${name} \
${optionalString connect "--run ${connectScript}"} \
${optionalString (! isNull run) "--run ${run}"} \
${optionalString (! isNull initial) "--level ${initial}"} \
${optionalString (adjustable && isNull group) "/dev/shm/mix/${name}/level"} \
${optionalString (! isNull group) "/dev/shm/mix/${group}/level"}
'';
User = "jack";
Group = "audio";
Nice = "-10";
LimitRTPRIO = "95:95";
LimitMEMLOCK = "infinity";
};
};
}
|